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!

How specify target frame

Status
Not open for further replies.

mihalych

Programmer
Jul 24, 2003
27
US
When I click the button in left frame, I want the page to load in the main frame. How can I write the code for button to specify the target frame.

Sub cmdButton_onClick()
location.href "main.html"
what about target frame??

End sub
 
You could just make a regular form button and put this script somewhere on your page:
<script language=javascript>
<!--
function OnButton1()
{
document.signout.action = &quot;PAGE.asp&quot;
document.signout.target = &quot;FRAME&quot;; // Specify frame
document.signout.submit(); // Submit the page
return true;
}
-->
</script>
<noscript>You need Javascript enabled for this to work</noscript>

And use this script for the button:
<form name=&quot;NAME&quot; action=&quot;page.asp method=&quot;post&quot;>
<input type=&quot;submit&quot; value=&quot;Button&quot; onclick=&quot;return OnButton1();&quot;>

If you want to have more than one button, just copy+paste the javascript code again into the same tag, only change the function part to Button2, and use the same button code, but again, change it to Button2, and so on.

Hope this helps! :)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top