Welcome to WebmasterWorld Guest from 54.196.126.39

Forum Moderators: open

Message Too Old, No Replies

Javascript popup window help

     
8:42 am on Aug 3, 2007 (gmt 0)

Preferred Member

10+ Year Member

joined:Nov 12, 2004
posts:550
votes: 0


Hi, I have been trying to do this for a while but couldn't make it right.


$popup="<a href=\"javascript:void(0)\" onclick=\"window.open('index3.php,status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=750,height=480,'); \" title=\"".$title."\">Link</a>";

If I echo $popup, the source code becomes:


<a href="javascript:void(0)" onclick="window.open(" index3.php,status="no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=750,height=480,');'" title="The Title">Link</a>

It doesn't work. It won't popup. Can you please tell me what's wrong with my code?

Thanks.

12:05 pm on Aug 3, 2007 (gmt 0)

Junior Member

10+ Year Member

joined:May 18, 2007
posts:49
votes: 0


<a href="javascript:void(0)" onclick="window.open(" index3.php,status="no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=750,height=480,');'" title="The Title">Link</a>

Why there is a comma after "height=480"?

12:10 pm on Aug 3, 2007 (gmt 0)

Full Member

10+ Year Member

joined:Oct 15, 2003
posts:276
votes: 0


It looks like you might be missing a couple of single quotes. Try this -

$popup="<a href=\"javascript:void(0)\" onclick=\"window.open('index3.php','status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=750,height=480'); \" title=\"".$title."\">Link</a>";

2:13 pm on Aug 3, 2007 (gmt 0)

Preferred Member

10+ Year Member

joined:Nov 12, 2004
posts:550
votes: 0


Hi! Thanks for your help, but still doesn't work. The generated source code becomes this:


onclick="window.open(" index3.php="" ,="" status="no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=750,height=480');'" ...

Notice the singe quote became double. A single quote also placed right after the semi colon. Any ideas why this?

2:49 pm on Aug 3, 2007 (gmt 0)

Full Member

10+ Year Member

joined:Oct 15, 2003
posts:276
votes: 0


Hmm...that's strange. I just tested the code on my server and it seemed to work fine. This is the output I got when I echoed $popup -

<a href="javascript:void(0)" onclick="window.open('index3.php','status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=750,height=480');" title="..">Link</a>

I'm not sure why your single quotes would be transformed into double quotes.

3:02 pm on Aug 3, 2007 (gmt 0)

Preferred Member

10+ Year Member

joined:Nov 12, 2004
posts:550
votes: 0


I am confused too. Could it be affected by other js script on the page?