javascript edit
Project ID: 1260536969
Project Details
  • Status:
    Closed (Chosen Programmer: kevinsz; Paid; Rated 10 out of 10)
  • Posted:
    12/11/2009 at 8:09 EST
  • Closed:
    12/11/2009 at 10:17 EST
  • Project Creator:
    Rated 10 out of 10 for this project.
  • Budget:
    $50
  • Description:
    Hi,

    This current javascript does a pop under onclick from a random rotation of urls everytime our users clicks a login submit button. I need it NOT to be random. First time visitor presses onclick button, display url 1. Second time visitor clicks onclick load url 2, and so on up to end of our url list, then repeat. This way it is kind of setup as a "round robin" setup and a user is not show same advertisement every time they login. I'm pretty sure this is done by setting different cookies, but I'm not sure. Here is my current code.


    <script type="text/javascript">
    function get_cookie(Name) {
    var search = Name + "="
    var returnvalue = "";
    if (document.cookie.length > 0) {
    offset = document.cookie.indexOf(search)
    if (offset != -1) { // if cookie exists
    offset += search.length
    // set index of beginning of value
    end = document.cookie.indexOf(";", offset);
    // set index of end of cookie value
    if (end == -1)
    end = document.cookie.length;
    returnvalue=unescape(document.cookie.substring(offset, end))
    }
    }
    return returnvalue;
    }

    function resetcookie(){
    var expireDate = new Date()
    expireDate.setHours(expireDate.getHours()-10)
    document.cookie = "tcpopunder=;path=/;expires=" + expireDate.toGMTString()
    }
    function loadornot(){
    if (get_cookie('tcpopunder')==''){
    loadpopunder()
    var expireDate = new Date()
    expireDate.setHours(expireDate.getHours()+parseInt(popfrequency))
    document.cookie = "tcpopunder="+parseInt(popfrequency)+";path=/;expires=" + expireDate.toGMTString()
    }
    }
    function loadpopunder(popunder, winfeatures){
    win2=window.open(popunder[Math.floor(Math.random()*(popunder.length))],"",winfeatures)
    win2.blur()
    window.focus()
    }
    function open_win() {

    var popunder=new Array()
    popunder[0]="http://www.yahoo.com"
    popunder[1]="http://www.bing.com"
    popunder[2]="http://www.ask.com"
    popunder[3]="http://www.google.com"

    var winfeatures="width=1024,height=800,scrollbars=1,resizable=1,toolbar=1,location=1,menubar=1,status=1,directories=0"

    var popfrequency="always"

    if (popfrequency=="always"){
    resetcookie()
    loadpopunder(popunder, winfeatures)
    }
    else{
    if (get_cookie('tcpopunder')!=parseInt(popfrequency))
    resetcookie()
    loadornot()
    }

    }

    </script>
  • Tags:
Project Bids
Programmer Bid Delivery Time Time of Bid Rating  
s3rvice $25 1 day 12/11/2009 at 8:22 EST 10.00/10
(4 reviews)
pacex $30 Immediately 12/11/2009 at 8:42 EST 10.00/10
(95 reviews)
I am interested in working with you. Please check the PMB!
kevinsz $30 2 hours 12/11/2009 at 8:34 EST 9.93/10
(55 reviews)
see PMB
maltasolutions $40 5 hours 12/11/2009 at 8:51 EST 8.00/10
(22 reviews)
Hi, i can do this for you if you like. Hope to speak further on ways to implement the round robin technique. i have a few options
nidhi $49 Immediately 12/11/2009 at 8:19 EST 10.00/10
(87 reviews)
quality work
akiles99 $50 Immediately 12/11/2009 at 8:18 EST 10.00/10
(217 reviews)
Lets get started now...
csajit $50 1 day 12/11/2009 at 8:13 EST 10.00/10
(84 reviews)
I can do it for you...pls check pmb