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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

onload() , loading two frames

Status
Not open for further replies.

dessie1981

Programmer
May 9, 2006
116
GB
Hi Everyone,

I need to reload two frames on my site when a certain page is called by the user at the moment i am doing this in the body tag of the script as follows

Code:
<body onLoad="parent.topFrame.location.reload();">

However as i have added more functionality to my site in need to load an additional frame also,

Does anyone know the synax to do this (reloading 2 frames) or the best solution here.

Any help would be great.

Regards
Dessie
 
two ways:

1. You can place multiple commands in the same attribute, separating them by semicolons.
Code:
<body onload="parent.topFrame.location.reload(); [b]parent.framename.location.reload();[/b]">

2. change the onload to call a function instead that has the JS.
Code:
<body onload="myscript();">
In the head of your HTML
Code:
<script type="text/javascript">
parent.topFrame.location.reload(); 
parent.framename.location.reload();
</script>

Pesonally i'd choose option 2, especially if you want to do a few things onload or onclick etc...




"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you.
 
oops, sorry missed the function name bit....HTML should be this...
Code:
<script type="text/javascript">
function myscript() {
parent.topFrame.location.reload(); 
parent.framename.location.reload();
}
</script>

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you.
 
Thanks for the quick reponse, worked a treat!

Regards
Dessie
 
no probs, glad to help :)

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top