Skip to main content
gamedev.net
🔒 Locked

[web] javascript - simple problem (i think)

Started by agm_ultimatex Feb 28, 2008 at 2:22 PM 2 replies 700+ views
Original Post
agm_ultimatex
agm_ultimatex
I wish to trigger a similar link to this via onClick in a textbox. The target is important, as the page i wish to link to is a layer that gets put into the iframe. Thanks.
Sander
Sander
IIRC you can just use window.open(). If you give the new window the same title as an existing open window, it will load in that window instead of opening a new window.
Harry Hunt
Harry Hunt
<textarea id="myText"></textarea><iframe id="myIFrame"></iframe><script type="text/&#106avascript">var myTextElement = document.getElementById("myText");var myIFrameElement = document.getElementById("myIFrame");myTextElement.onclick = function() {    myIFrameElement.contentWindow.location.href = "mypage.html";};</script>
agm_ultimatex
agm_ultimatex
Quote:
Original post by Harry Hunt
<textarea id="myText"></textarea><iframe id="myIFrame"></iframe><script type="text/&#106avascript">var myTextElement = document.getElementById("myText");var myIFrameElement = document.getElementById("myIFrame");myTextElement.onclick = function() {    myIFrameElement.contentWindow.location.href = "mypage.html";};</script>


modified it a bit for my app, it works perfectly thanks :D

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.