Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

loading mulitple pages at one time 2

Status
Not open for further replies.

visualJay

Programmer
Jun 14, 2001
57
US
I am trying to load new pages to each section of a frame page at one time. When the user clicks a link on a page loaded into the main frame section it will load a new page in the left frame section, main frame section and the bottom frame section. Can this be done in HTML or javascript.

Thank you
 
add name='framename' to you <frame> tags.

add target='framename' to your <a> tags.
 
TheocraticMind's suggestion will help you specify a single target for any given <a> tag, but if you're looking for a single link to change the location of more than one frame, you'll need to use JavaScript or a server-side scripting language like PHP, ASP, or ColdFusion. Since this is the HTML/CSS forum, I'll demonstrate the JavaScript solution:

given frames named:[ul][li]topframe[/li][li]leftframe[/li][li]mainframe[/li][/ul]your script (which must reside in the same frame as your links) would read like this:
Code:
<script type=&quot;text/javascript&quot; language=&quot;JavaScript&quot;>
  function changePage(strURL1,strURL2,strURL3)
  {
     top.frames[&quot;topframe&quot;].location.href = strURL1;
     top.frames[&quot;leftframe&quot;].location.href = strURL1;
     top.frames[&quot;mainframe&quot;].location.href = strURL1;
  }
</script>
Then your links would look like this:
Code:
<a href=&quot;page4.html&quot; target=&quot;_top&quot; onclick=&quot;changePage('page1.html','page2.html','page3.html');return false;&quot;>Link Text</a>
Notice that the HREF property of the <a> tag points to a different page altogether -- user agents that don't support JS (or that have JS turned off) will get only that action. You'll need to tailor this part of the solution to your specific needs.
 
Can this java script be applied to a submit button
 
Are you looking to submit the form data to more than one page, or just change the location of two other frames when you submit the form in the main frame?

If it's the latter, simply change the function to this:
Code:
<script type=&quot;text/javascript&quot; language=&quot;JavaScript&quot;>
  function formSubmit(strURL1,strURL2,strURL3)
  {
     top.frames[&quot;topframe&quot;].location.href = strURL1;
     top.frames[&quot;leftframe&quot;].location.href = strURL2;
     document.frames[&quot;frame1&quot;].action = strURL3;
     document.frames[&quot;frame1&quot;].submit();
  }
</script>
Then your form would look like this:
Code:
<form action=&quot;formHandler.cgi&quot; onsubmit=&quot;formSubmit(strURL1,strURL2,strURL3); return false;&quot;>
   form contents here
   <input type=&quot;submit&quot; name=&quot;btnSubmit&quot; value=&quot;Submit this form!&quot; />
</form>
Once again, clients without JavaScript will get just the formHandler.cgi page.
 
heh. i apologise for my response, i didn't read your post close enough. but maybe this will help you some. in order to have the first solution work with a button, use this:

<form onSubmit=&quot;changePage('whatever1.html','whatever2.html','whatever3.html'); return false;&quot;>
<input type=&quot;submit&quot; name=&quot;change_pages&quot; value=&quot;Change Pages&quot;>
</form>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top