Click to See Complete Forum and Search --> : Iframe Write


diamonds
06-02-2003, 07:46 PM
Ermm... how do you write to an iframe using iframe.document.write(html) and iframe.innerhtml=html or the like?:confused:

gil davis
06-02-2003, 08:01 PM
Assuming your iframe i called "iframeName":
window.top.frames["iframeName"].document.write(html);
window.top.frames["iframeName"].document.close();
orwindow.top.frames["iframeName"].innerHTML = html;Remember that many JavaScript parameters are CaSe SeNsItIvE.

Jona
06-02-2003, 10:19 PM
This may help: http://jona.t35.com/experiments/writetoiframe.html

Jona

diamonds
06-03-2003, 02:36 PM
What's Wrong? NO error is returned, but it just dosen't work!:confused: the .write works, though! any idea what is happining?

<html>
<head>
<script>
function html(html){
window.top.frames["iframe"].innerHTML = html
}
</script>

</head><body>
<form name=abc>
<iframe src="about:blank" id="iframe"> </iframe>
<P>
<textarea rows="5" cols="30" name="def">HTML woks, too!</textarea><br>
<input type=button value="Make HTML" onclick="html(document.abc.def.value)">
</form>
</body>
</html>

Jona
06-03-2003, 02:38 PM
Try changing the name of your function... And make sure your browser version is above or at 6. ;)

Jona

diamonds
06-03-2003, 02:55 PM
Name of my function?
change it to what?

hmmm... my browser(IE) is version: [insert trumpets here]
6.0.2800.1106

is there a newer version?:rolleyes:

Jona
06-03-2003, 03:10 PM
Um, I think your browser works fine. But I mean like change the name of the function to something else that's not the same as a variable... Come to think of it, you might want to change the variable's name, too! :p

Jona