1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

how to implement this javascript code

Discussion in 'HTML & JavaScript' started by raj564, Mar 19, 2009.

  1. raj564

    raj564 Regular Member

    Joined:
    Dec 6, 2007
    Messages:
    317
    Likes Received:
    93
    Location:
    like the way this guy has his coupons setup.

    You habe to click on it for the coupon to show up on a popup, while the page loads to the clients site dropping the cookie. Can someone figure out the JS code? i couldnt find the file it was accessing. The JS script calls these DisplayCoupon functions, but i cant find the source code.

    Code:
    http://www.meancoupons.com/petsmart/
    click "Activate Coupon" to see what I mean.
     
  2. krishananda

    krishananda Elite Member

    Joined:
    Mar 21, 2009
    Messages:
    1,985
    Likes Received:
    338
    Location:
    Bandung, Indonesia
    You can find the whole script here:

    HTML:
    http://www.meancoupons.com/scripts/bookmark_popup.js
    and the function displaycoupon:

    HTML:
    function displaycoupon(param2){var couponcode = param2;if (couponcode != 'coupon' && couponcode != 'n/a')
    {OpenWindow=window.open("", "newwin", "height=150, width=250,toolbar=no,scrollbars="+scroll+",menubar=no");OpenWindow.document.write("<TITLE>Use this Coupon Code<\/TITLE>");OpenWindow.document.write("<BODY BGCOLOR=#ffffcc>");OpenWindow.document.write("<table><tr><td style='border: 2px dashed #808080'>");OpenWindow.document.write("<center>");OpenWindow.document.write("Enter This Coupon Code At Checkout:");OpenWindow.document.write("<p>");OpenWindow.document.write("<strong>");OpenWindow.document.write(couponcode);OpenWindow.document.write("<\/strong>");OpenWindow.document.write("<\/p>");OpenWindow.document.write("<br>");
    OpenWindow.document.write("<\/td><\/tr><\/table>");OpenWindow.document.write("<\/BODY>");OpenWindow.document.write("<\/HTML>");OpenWindow.document.close();
    OpenWindow.focus();}if (couponcode == 'coupon' || couponcode == 'n/a'){OpenWindow=window.open("", "newwin", "height=150, width=250,toolbar=no,scrollbars="+scroll+",menubar=no");OpenWindow.document.write("<TITLE>Coupon Code<\/TITLE>");OpenWindow.document.write("<BODY BGCOLOR=#ffffcc>");OpenWindow.document.write("<table><tr><td style='border: 2px dashed #808080'>");OpenWindow.document.write("<center>");OpenWindow.document.write("Coupon Code Automatically Applied During Checkout:");OpenWindow.document.write("<\/td><\/tr><\/table>");OpenWindow.document.write("<\/BODY>");OpenWindow.document.write("<\/HTML>");OpenWindow.document.close();OpenWindow.focus();}}