Results 1 to 5 of 5

Thread: [RESOLVED] Javascript window.open()

  1. #1

    Thread Starter
    Frenzied Member the182guy's Avatar
    Join Date
    Nov 2005
    Location
    Cheshire, UK
    Posts
    1,473

    Resolved [RESOLVED] Javascript window.open()

    Paypal has given me this snippet which is a image link that is supposed to open a new window on click to show that an item has been added to the shopping cart, but its not firing the new window up. Here it is:

    Code:
    <a href="#" onclick="window.open('https://www.paypal.com/cart/add=1&
    [email protected]&item_name=oil+change+service&
    item_number=1111&amount=29.99&image_url=http%3A//www.davesgarage.com/logo.gif&
    return=http%3A//www.davesgarage.com/success.html&cancel_return=http%3A//www.davesgarage.com/cancel.html&
    no_note=1','cartwin','width=600,height=400,scrollbars,location,resizable,status');">
    <img src="http://images.paypal.com/images/sc-but-01.gif" border="0"></a>
    Any ideas?
    Chris

  2. #2
    Frenzied Member tr333's Avatar
    Join Date
    Nov 2004
    Location
    /dev/st0
    Posts
    1,605

    Re: Javascript window.open()

    Do you have a pop-up blocker turned on? These sometimes block javascript from opening new windows.
    CSS layout comes in to the 21st century with flexbox!
    Just another Perl hacker,

  3. #3

    Thread Starter
    Frenzied Member the182guy's Avatar
    Join Date
    Nov 2005
    Location
    Cheshire, UK
    Posts
    1,473

    Re: Javascript window.open()

    Yeah, normally FF tells me when a popup is being blocked and it doesn't when I do this. Doesn't work in IE either. The weird thing is if I use the simple examply on W3schools that uses a function it works fine on a normal URL but when I enter my long paypal URL it doesn't work.
    Chris

  4. #4
    Frenzied Member
    Join Date
    Aug 2000
    Location
    Birmingham, AL
    Posts
    1,276

    Re: Javascript window.open()

    Quote Originally Posted by the182guy
    Paypal has given me this snippet which is a image link that is supposed to open a new window on click to show that an item has been added to the shopping cart, but its not firing the new window up. Here it is:

    Code:
    <a href="#" onclick="window.open('https://www.paypal.com/cart/add=1&
    [email protected]&item_name=oil+change+service&
    item_number=1111&amount=29.99&image_url=http%3A//www.davesgarage.com/logo.gif&
    return=http%3A//www.davesgarage.com/success.html&cancel_return=http%3A//www.davesgarage.com/cancel.html&
    no_note=1','cartwin','width=600,height=400,scrollbars,location,resizable,status');">
    <img src="http://images.paypal.com/images/sc-but-01.gif" border="0"></a>
    Any ideas?
    You need to remove the CRLF (Carriage Return, Line Feed) from the end of each line of your code to keep the javascript on one line. I did this and was able to get your code working.

  5. #5

    Thread Starter
    Frenzied Member the182guy's Avatar
    Join Date
    Nov 2005
    Location
    Cheshire, UK
    Posts
    1,473

    Re: Javascript window.open()

    Cheers mate.
    Chris

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width