homepage Welcome to WebmasterWorld Guest from 54.161.202.234
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
Javascript popup window help
thegreatpretender




msg:3412496
 8:42 am on Aug 3, 2007 (gmt 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.

 

IndiaMaster




msg:3412584
 12:05 pm on Aug 3, 2007 (gmt 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"?

coho75




msg:3412590
 12:10 pm on Aug 3, 2007 (gmt 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>";

thegreatpretender




msg:3412718
 2:13 pm on Aug 3, 2007 (gmt 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?

coho75




msg:3412747
 2:49 pm on Aug 3, 2007 (gmt 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.

thegreatpretender




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

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

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved