Is it possible to move this to the javascript section of the website I don't want to cross post since it is usually frowned up on?
So I had been doing some investigating and came up with a simple page to demonstrate my problem. This has no problems in firefox or chrome and seems to effect IE only.
Below is code where javascript writes an iframe's content.
works good till you click the button in the iframe 26 times then IE
throws an error
At which point the iframe is blank if I press just the outside button it has no problems. Maybe it has to do that the function being called has no page to return to since it is overwritten. How should I go about fixing this?SCRIPT28: Could not complete the operation due to error 800a001c.
My current work around is as follows. I create a variable firstwrite then set it to true. In my write_page function if firstwrite is true I use the open write close method and set firstwrite equal to false then any other calls I set body.innerHTML to the output this seems to work but am I suppose to do anything special when calling a parents function that changes the current iframe?
Code:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-type" content="text/html;charset=UTF-8"> <title>IE Crasher</title> <script type='text/javascript'> var mycontentdocument=null; var count=0; //<!-- // function to build html objects // expected arguments=tag,data,prefs //--> function h() {var tag=""; var data=""; var prefs=""; for (var i = 0; i < arguments.length; i++) {if(i==0){tag=arguments[i];} if(i==1){data=arguments[i];} if(i==2){prefs=arguments[i];} } var retval="\<"+tag; if(prefs!=""){retval+=" "+prefs;} retval+="\>"+data+"\</"+tag+"\>"; return retval; } function write_page(body) {var output='\<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"\>\n'; var head='\n\<meta http-equiv="Content-type" content="text/html;charset=UTF-8"\>\n'+h("title")+'\n'; output+=h("html","\n"+h("head",head)+"\n"+h("body","\n"+body)+"\n") // alert(output); mycontentdocument.open("text/html","replace"); mycontentdocument.write(output); mycontentdocument.close(); } function increment() {var body="<input type=button value='next' onclick='parent.increment()'>\n"+(count++); write_page(body); } function init() {mycontentdocument=document.getElementById('mycontent').contentDocument; if(!mycontentdocument){mycontentdocument=document.frames['mycontent'].document;} increment(); } </script> </head> <body onload='init()'> <iframe id='mycontent' class='fullscreen'></iframe><br> <input type=button value='next' onclick='increment()'> </body> </html>


Reply With Quote

Bookmarks