/    Sign up×
Community /Pin to ProfileBookmark

Breaking on Jscript Runtime Error in IE8 and IE9

Hi All,

For the first pop i was able to pop up the windows with the element “this is my inner HTML!”, but after i close the pop windows, and try to re-pop again, it hitting the error at this line ” element=pop0.createElement(tag)”.

Any help appreciated.

here is the code.

<html>
<head>
<script type=”text/javascript”>

var pop0=null;

function customSetup(URL,name,param,title)
{
winbody=newWindow(URL,name,param,title);
newElement(‘div’,winbody,”this is my inner HTML!”);
}

function newWindow(URL,name,param,title)
{
if (URL==null) URL=”;
win=window.open(URL,name,param);
windoc=win.document;
windoc.write(“<html><head><title>”+title+”</title></head>”);
windoc.write(“<body></body></html>”);
windoc.close();
winbody=windoc.getElementsByTagName(‘body’)[0];
if (pop0==null) pop0=windoc;
return winbody;
}

function newElement(tag,node,iHTML)
{
element=pop0.createElement(tag);
if (iHTML!=null)
element.innerHTML=iHTML;
node.appendChild(element);
}

</script>
</head>

<input type=”button” onClick=”customSetup(null,’newWin’,’width=250,height=250′,’My Title!’)” value=”POP2!”>

</body>
</html>

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @rueyzzz spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...