Jump to content

[SOLVED] window.open ... new winow onclick


d22552000

Recommended Posts

 

<a href="javascript:window.open('splay.php?id=1871032','Play Song','height=100,width=300,resizable=no,scrollbars=no,toolbar=no,status=no');">

 

no matter what I do, it alwasy says:

 

Line: 1
Char: 1
Error: Invalid Argument
Code: 0

 

Please help me ><  I am getting fed up with JS.

Link to comment
Share on other sites

not working.

 

now im using this: but it give different errors:

 

**PAGE HEADER STUFF AND CSS**

<script language="javascript" type="text/javascript">
function popitup(url) {
newwindow=window.open(url,'?','height=100,width=300,resizable=no,scrollbars=no,toolbar=no,status=no');
if (window.focus) {newwindow.focus()}
return false;
}
</script>
</head>
** PAGE BODY STUFF **

<a href='play.php?id=2318454' onclick="return popitup('splay.php?id=2318454');">

** PAGE BODY STUFF **

 

Now, this works fine in forefox, opens the popup and ignores the href because it returned false.  BUT IN IE 7 this gives me 1 error and goes to the HREF.

 

Line: 30
Char: 2
Error: Invalid Argument
Code: 0

 

Line 30 is the <A href thing

Link to comment
Share on other sites

you can do that like this:

 

<script language="javascript">
function popitup(url) 
{
window.open(url,'Play_Song','height=100,width=300,resizable=no,scrollbars=no,toolbar=no,status=no');
}
</script>
</head>
<body>

<a href="play.php?id=2318454" onclick="popitup('splay.php?id=1871032'); return false">click here</a>

 

or............ like this:

 

<a href="play.php?id=2318454" onclick="javascript:window.open('splay.php?id=1871032','Play_Song','height=100,width=300,resizable=no,scrollbars=no,toolbar=no,status=no'); return false">click me</a>

 

the error is probably happening because; in the pop-up name; "Play Song" is not connected. you need to make sure that the pop window name is not separated. see if that fixes the error; because the code I have given you has been tested  in IE6, IE7, and FFv2.0.0.4; it works perfectly fine. also, if the file does not exist some where in your directory; your may get an error too. i would suggest that you also download FireBug; it is a FireFox Add-On, that will help you find simple errors in your JS and HTML files.

Link to comment
Share on other sites

d22552000; I use the exact code below in a site that I have designed and it is compatible with IE7.

 

<a href="javascript:void(0)" onclick="window.open('ics.php?id=13','slideshow','resize=no,scrollbar=yes,menubar=no,directories=no,statusbar=no,width=502,height=398,toolbar=no,top=0,left=0')">View Slideshow</a>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

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

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.