Rainel Posted May 9, 2006 Share Posted May 9, 2006 Hey guys..could you help me about this code..when i close the close button after opening a window it says that win[].closed is null or not an object.could you please explain me about this one..thnksmy full code is:<html> <head> <script language='javascript'> var win = new Array(); var num=0; var ctr=0; //t=0; //l=0; but=0; function dynPages(){ var n = new Array('00','37','7F','B7','FF'); with(parent.body_link){ document.write('<html><head></head>'); document.write('<body><center>'); document.write("<h1>Rainel's Page</h1>"); document.write("<img src='images/homelogo.jpg'border='0'>"); document.write("<table border='1'cellpadding='0'cellspacing='0'>"); for(i=0;i<5;i++){ document.write('<tr>'); for(y=0;y<5;y++){ for(x=0;x<5;x++){ document.write("<td bgcolor='#" + n + n[y] + n[x]+"'><font size=1>"); document.write(n+ n[y]+ n[x]); document.write('</font></td>'); } } document.write('</tr>'); } document.write('</center></table></body></html>'); } } function open_win(){ win[num]=open("","myWin" + num,"menubar=1,resizable=1,width=350,height=250,top=10,left=10"); //win[num].focus(); with(win[num]){ document.write('<html><head></head>'); document.write('<body><center>'); document.write('<hr size=2>'); document.write("<h4>"); document.write('win' + ctr); document.write("</h4>"); document.write('<h1>Welcome to</br>'); document.write('my</br>'); document.write('popup</h1>'); document.write('<hr size=2>'); document.write("<input type='button' onclick='java script:window.close()'value='CLOSE'>"); document.write('</center></body></html>'); } num++; ctr++; frontAll(); } function close_win(){ if(win[ctr].closed!=0){ win[ctr].close(); ctr--; } } function frontAll(){ for(i=0;i<win.length;i++){ win.focus(); } } </script> </head> <body> <table border='0'> <tr><td><input type='button'value='Dynamic Pages'name='but1'onclick='dynPages()'></td></tr> <tr><td><input type='button'value='Open New Window'name='but2'onclick='open_win()'></td></tr> <tr><td><input type='button'value='Close Window'name='but3'onclick='close_win()'></td></tr> </table> </body></html> Link to comment Share on other sites More sharing options...
Nakor Posted May 9, 2006 Share Posted May 9, 2006 That's probably because win[].closed isn't an object. You should use win.closed. Link to comment Share on other sites More sharing options...
aspnetguy Posted May 9, 2006 Share Posted May 9, 2006 That's probably because win[].closed isn't an object. You should use win.closed.<{POST_SNAPBACK}> win[] is an array of window objects!!!Is there a specific reason you are doing it like this??? Link to comment Share on other sites More sharing options...
pulpfiction Posted May 9, 2006 Share Posted May 9, 2006 When you click the "Open New Window" button it creates a popup with this message. if you click the button many times then it creates many popups with msg. win0 win1 win2 win3 [ array ], win0Welcome tomypopupso i think what he's trying to do is to close the popup 1 by 1 on every "close window" click Link to comment Share on other sites More sharing options...
Rainel Posted May 11, 2006 Author Share Posted May 11, 2006 When you click the "Open New Window" button it creates a popup with this message. if you click the button many times then it creates many popups with msg. win0 win1 win2 win3 [ array ], win0Welcome tomypopupso i think what he's trying to do is to close the popup 1 by 1 on every "close window" click<{POST_SNAPBACK}> yeahh dat's it i want my pop up window will b close 1 by 1 by the close button...but anyway guys thanks for the rply this is my first time when i got into forum... Link to comment Share on other sites More sharing options...
Rainel Posted May 11, 2006 Author Share Posted May 11, 2006 When you click the "Open New Window" button it creates a popup with this message. if you click the button many times then it creates many popups with msg. win0 win1 win2 win3 [ array ], win0Welcome tomypopupso i think what he's trying to do is to close the popup 1 by 1 on every "close window" click<{POST_SNAPBACK}> yeahh dat's it i want my pop up window will b close 1 by 1 by the close button...thnks for the reply.. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now