Jump to content

Javascript Popup


kaz

Recommended Posts

><script type="text/javascript">
<!--

function OpenvBChat(){
vBChat = window.open('vBChat.php?$session[sessionurl]','vBChat','directories=no,height='400',width='600',location=no,menubar=no,scrollbars=yes,status=no,toolbar=no')

return false;
}

-->
</script>
<!---- start HTML Link----->
<a href="vBChat.php?$session[sessionurl]" onclick="return OpenvBChat();">Chat Room</a>

 

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

 

-kaz

Link to comment
Share on other sites

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:

>vBChat = window.open('vBChat.php?$session[sessionurl]','vBChat', 'directories=no,height=400,width=600,location=no,menubar=no,scrollbars=yes,status=
o,toolbar=no');

Give it a shot and see if it makes your script works any better. :)

 

Update: 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.

Edited by TCH-David
Link to comment
Share on other sites

Kaz, remember that the ' or "single quote mark" signifies the beginning and end of a string in JavaScript. So when you type this:

 

>'directories=no,height='400',width='600',location=no,menubar=no,scrollbars=yes,status=no,toolbar=no'

 

Javascript sees:

 

>'directories=no,height='

 

as one string,

 

>',width='

 

as another, and

 

>',location=no,menubar=no,scrollbars=yes,status=no,toolbar=no'

 

as another, with some non-string values in between.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...