...

View Full Version : Is there any way to change an iframe through inputs?



adsims
12-26-2003, 06:01 AM
Is there any way to change the source of an IFRAME through a text box input?

COBOLdinosaur
12-26-2003, 11:57 PM
<html>
<head>
<title>change frame</title>
</head>
<body>
<iframe name="theiframe" src"blah.html"></iframe>
<br />
<br />
<form>
<input type="text" name="theurl">
<input type="button" value="change Iframe">
onClick="top.frames['theiframe'].location.href=this.form.theurl.value">
</form>
</body>
</html>

ahosang
12-27-2003, 04:42 PM
With this, remember the history is changed. In certain cases of changing an iframe's location.href property, you may prefer the location.replace method(like an updating data iframe or something).

P.S.
Hello Cd, and Merry Yuletide Season :-)

COBOLdinosaur
12-27-2003, 07:52 PM
Same to you ahosang. I trust you have overindulged in all the good food and drink like I have. :thumbsup:

Mzungu
12-29-2003, 09:30 PM
I feel quite dull not being able figure it out myself...

How can I make a link do the same, i.e. change the src-attribute of an iframe?

This is what I have:
<iframe name="iframe" src="somesite.html">

Can I do something like:
<a href="javascript:...">

Thanks
Mz

COBOLdinosaur
12-30-2003, 01:12 AM
Its even easier with a link:

<a href="somenewpage.html" target="iframe"> new page</a>

It does not even require script



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum