Welcome to WebmasterWorld Guest from 54.145.144.101

Forum Moderators: open

Message Too Old, No Replies

Javascript popup window help

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

10+ Year Member



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)

5+ Year Member



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

10+ Year Member



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)

10+ Year Member



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)

10+ Year Member



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)

10+ Year Member



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

Featured Threads

Hot Threads This Week

Hot Threads This Month