Cookies, window.open, and more

Discussion in 'JavaScript' started by nfzgrld, Nov 22, 2008.

  1. #1
    I had posted previously about passing js generated vars via a query string. It's become very apparent that this is not possible. So, I'm now trying to accomplish the mission by sending the vars via cookie. Ok, that will work, but I have a different problem now. Please take a look at the code below and tell me: Why doesn't the window open?

    
    function kick(eid) {
    	var exdate=new Date();
    	exdate.setDate(exdate.getDate()+1);
    	document.cookie=eid+ "=" +escape(eid)+("" : ";expires="+exdate.toGMTString());
    	document.cookie=xco+ "=" +escape(xco())+("" : ";expires="+exdate.toGMTString());
    	document.cookie=yco+ "=" +escape(yco())+("" : ";expires="+exdate.toGMTString());
    	window.open("/execute/j_input.php","j_input","menubar=no,width=100,height=100,toolbar=no,scrollbars=no,status=no,resizable=no");
    }
    
    Code (markup):
    I'm calling that function like this:

    
    <div id="drag" class="postit" style="top:135px;left:135px" onmouseup="kick(1)">
    
    HTML:
    I'm not even sure if the cookies are set properly. If I can get the window to open it will tell me what's going on and I can work from there. Any insight would be appreciated.
     
    nfzgrld, Nov 22, 2008 IP
  2. GreatMetro

    GreatMetro Peon

    Messages:
    117
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    The function errors out on:

    document.cookie=eid+ "=" +escape(eid)+("" : ";expires="+exdate.toGMTString());

    try:

    document.cookie=eid+ "=" +escape(eid)+";expires="+exdate.toGMTString();

    Also I recommend firefox with web developer toolbar and firebug to see where javascript is erroring out.

    Good luck
     
    GreatMetro, Nov 22, 2008 IP