954,597 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Javascript onclick events problem

Hello all,

I have this code in an iframe

<FORM><INPUT TYPE="BUTTON" VALUE="Go Back"
ONCLICK="history.go(-1)"></FORM>


it works fine but i need it to taget another iframe on the page and change that iframe and go back in its own iframe

Thanks in advance.

komrad
Light Poster
42 posts since Sep 2006
Reputation Points: 7
Solved Threads: 2
 

Am not sure if this is what you need.

<!-- Assuming that this the targeted frame in your page -->
<iframe id="frame1"  src="myPage.html" width="700" height="700"></iframe>

<FORM><INPUT TYPE="BUTTON" VALUE="Go Back"
ONCLICK="document.getElementById('frame1').contentWindow.location = 'someLocation.html';"></FORM>

<!-- Just another option -->

<FORM><INPUT TYPE="BUTTON" VALUE="Go Back"
ONCLICK="document.getElementById('frame1').src = 'someLocation.html';"></FORM>
essential
Posting Shark
974 posts since Aug 2008
Reputation Points: 114
Solved Threads: 138
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You