I found this script:
External:
Head:Code:// Redirect Cookie 2 // Version 1.10 // Written by Chris Hansen. // Copyright © 1999-2003 by Chris Hansen. function getCookieVal(offset){ var endstr = document.cookie.indexOf(";", offset); if (endstr == -1) endstr = document.cookie.length; return unescape(document.cookie.substring(offset, endstr)); } function GetCookie(name){ var arg = name + "="; var alen = arg.length; var clen = document.cookie.length; var i = 0; while (i < clen){ var j = i + alen; if (document.cookie.substring(i, j) == arg) return getCookieVal(j); i = document.cookie.indexOf(" ", i) + 1; if (i == 0) break; } return ""; } function SetCookie(name, value){ expDays = 365; exp = new Date(); exp.setTime(exp.getTime() + (expDays * 24 * 60 * 60 * 1000)); document.cookie = name + "=" + escape(value) + "; expires=" + exp.toGMTString(); } function cRedirect(value){ SetCookie("cChoise", value); } function IsCookieSet() { var redirpage = GetCookie("cChoise"); if (redirpage != "") {window.location = redirpage;} }
Menu:Code:function menuRedirect(){ var select = eval(document.redirectForm.elements[0].selectedIndex); var choise1 = "choise1.html"; var choise2 = "default/index.html"; if (select==0) void(0); else if (select==1) {window.open(choise1,"_top"); cRedirect(choise1);} else if (select==2) {window.open(choise2,"_top"); cRedirect(choise2);} }
I've found 2 problems, 1 if I try to change anything, the cookie part (top) has to be removed otherwise nothing happens, I suspect theres an ID I'm missing and not changing, but thats minor. For some reason, whenever I run that in my browser it doesn't remember after a close. I looked it over and tried changing a few things, but no luck.Code:<FORM name="redirectForm"> <TABLE border="1" cellspacing="0" cellpadding="0"> <TR> <TD> <SELECT name="menu" onChange="menuRedirect()"> <OPTION value="1">Make A Choise</OPTION> <OPTION value="2">Choise 1</OPTION> <OPTION value="3">Choise 2</OPTION> </SELECT> </TD> </TR> </TABLE> </FORM>![]()



Reply With Quote

Bookmarks