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!

buttons with javascript for onclick to URL plus frames 2

Status
Not open for further replies.

jhherring

Programmer
Jun 18, 2002
33
US
Another odd one. Can anyone help?

Page A is done in frames. A form in one frame on Page A has buttons at the bottom, like this:

<form>

<input type=&quot;button&quot; value=&quot;Clear Form&quot; onClick=&quot;document.main_form.reset()&quot;>

<input type=&quot;button&quot; value=&quot;Send Request&quot; onclick=&quot;javascript:window.location.href='URL-for-Page-B'&quot;>

</form>

These buttons work fine, but I want Page B (which is also built in frames), to load into _top, so that it doesn't load into the frame calling it. I don't know on which page to add the frame-breaking code, if any. The frameset page for Page B? Or maybe I should alter the onclick syntax to specify _top?

To make things worse, I have to do the same thing on Page B, so the link on it back to Page A will also not load into a particular frame on Page B.

Lost, confused, and grateful for any help.

John Herring
jhherring@yahoo.com



 
hi John,

try this:

<input type=&quot;button&quot; value=&quot;Send Request&quot; onclick=&quot;javascript:window.top.location.href='URL-for-Page-B'&quot;>

======================================

if (!succeed) try();
-jeff
 
Perfecto! Neat, clean, solves the problem 100% -- as I have come to expect from the experts in this forum. Thank you, sir!

 
jemminger,

the javascript: pseudo-protocol is not needed when using onclick but only inside href=&quot;&quot; to tell the browser to use the javascript engine instead of just sending to a url. Gary Haran
 
You're absolutely right, Mr. Haran. Thanks for the tip.

 
yep - I let that slip by...thanks gary!
======================================

if (!succeed) try();
-jeff
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top