javascript - set innerHTML of an iframe -


in javascript, how can set innerhtml of iframe? mean: how set, not get.

window["ifrm_name"].document.innerhtml= "<h1>hi</h1>" not work, , same other solutions.

iframe , parent document on same domain.

i need set html of whole document iframe, not body.

i need avoid jquery solution.

a simple example ...

<iframe id="fred" width="200" height="200"></iframe> 

then following javascript run, either inline, part of event, etc ...

var s = document.getelementbyid('fred'); s.contentdocument.write("fred rules"); 

the "contentdocument" equivalent of "document" in main window, can make calls against set body, head, elements inside ... etc.

i've tested in ie8, chrome , firefox ... may want test in ie6/7 if have copies available.


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -