Jump to content

Javascript Popup


sean04

Recommended Posts

Hey,

 

So I have this:

 

echo "<a href=\"javascript:window.open('page.php','name1','height=320,width=240');\">pop-up</a>";

 

In Chrome, the popup works great, in IE the pop up take a while to popup and then the page itself where the popup link was goes white and says [Object].

 

Any ideas? Not sure why it doesn't work in IE.

Link to comment
Share on other sites

Your link is not properly formed. the HREF attribute indicates that a new page should be opened.  When the window.open() funtion runs, it returns an object, and that is what the white page is telling you.  I'm not sure you can accomplish this with HREF.  You could use the ONCLICK attribute (instead of the HREF) but then you might not get the visual indicators that it is a link (use CSS to change the style of that link).

<a onclick="window.open('page.php','name1','height=320,width=240');">pop-up</a>

Link to comment
Share on other sites

DavidAM is totally correct. I completely overlooked the fact that you weren't using the onclick event. Generally I use href="#" when there isn't one, so I'm not sure how various browsers will react with having no href attribute.

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.