Javascript Popup

windows

Guest
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1--><script type="text/javascript"><br /><!--<br /><br />function OpenvBChat(){<br />vBChat = window.open('vBChat.php?$session[sessionurl]','vBChat','directories=no,height='400',width='600',location=no,menubar=no,scrollbars=yes,status=no,toolbar=no')<br /><br />return false;<br />}<br /><br />--><br /></script><br /><!---- start HTML Link-----><br /><a href=http://www.totalchoicehosting.com/forums/lofiversion/index.php/"vBChat.php?$session[sessionurl]" onclick="return OpenvBChat();">Chat Room</a><!--c2--></div><!--ec2--><br /><br />It wont open it in a new window with the new sizes (width and height specified) it acts like a normal link and shows that java error, quite frankly i find it really damn annoying can someone help before i swear<br /><br />-kaz<!--content-->
I believe the problem is that you've quoted the height and width attributes and they should not be. The window.open method takes three arguments - the URL to open, the name of the window, and a single string describing the features of the new window to open. The quotes you have around the height and width prevent the javascript from seeing the feature list as a single string. I think your code should corrected like this:<br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->vBChat = window.open('vBChat.php?$session[sessionurl]','vBChat', 'directories=no,height=400,width=600,location=no,menubar=no,scrollbars=yes,status=<br />o,toolbar=no');<!--c2--></div><!--ec2--><br />Give it a shot and see if it makes your script works any better. <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /><br /><br /><b>Update:</b> For some reason, the board is insisting on escaping one of the quotes, even though it is inside of a set of CODE tags. Where you see & #39; in the function above, that should also be a ' mark.<!--content-->
Kaz, remember that the ' or "single quote mark" signifies the beginning and end of a string in JavaScript. So when you type this:<br /><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->'directories=no,height='400',width='600',location=no,menubar=no,scrollbars=yes,status=no,toolbar=no'<!--c2--></div><!--ec2--><br /><br />Javascript sees:<br /><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->'directories=no,height='<!--c2--></div><!--ec2--><br /><br />as one string,<br /><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->',width='<!--c2--></div><!--ec2--><br /><br />as another, and <br /><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->',location=no,menubar=no,scrollbars=yes,status=no,toolbar=no'<!--c2--></div><!--ec2--><br /><br />as another, with some non-string values in between.<!--content-->
So basically make it all with " that quotes<!--content-->
You need to remove the quotes you have on the height and width. It doesn't matter if it's a single or double quote - neither are supposed to be there.<!--content-->
 
Back
Top