im trying to have it save menu selections, i was thinking either cookies or
storing it in the .window thing but i am unsure of how to do these, any help would be great.
<script type="text/javascript">
function setCookie(c_name,value,exdays)
{
var exdate=new Date();
exdate.setDate(exdate.getDate() + exdays);
var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString());
document.cookie=c_name + "=" + c_value;
}
function getCookie(c_name)
{
var i,x,y,ARRcookies=document.cookie.split(";");
for (i=0;i<ARRcookies.length;i++)
{
x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("="));
y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1);
x=x.replace(/^\\s+|\\s+$/g,"");
if (x==c_name)
{
return unescape(y);
}
}
}
<!--
// initialise shortcuts on page load
var selectObj1=null, selectObj2=null// global
function init()
{ selectObj1=document.getElementById("select_1");
selectObj2=document.getElementById("select_2");
selectObj2.disabled=true;
// ========== end init() ==============
// second select box options list
var A= new Array()
A["remote 1"]=["0","yup","DVD-1"];
A["remote 2"]=["0","VCR-1","DVD-2"];
//
// global variables
var saveObj=null, indx=null, targetObj=null, selectNo=null;
//
function process(obj,sNumb)
{ // disable unused select boxes
if(sNumb==1)
{ selectObj1.selectedIndex="0";
selectObj1.disabled=true;
}
else if( sNumb==2)
{ selectObj1.selectedIndex="0";
selectObj1.disabled=true;
}
//
// store selected index
indx=obj.options.selectedIndex;
// invalid selection
if(indx==0){ return; }
// ---------
// save passed parameters for use after timeout deleay
saveObj=obj, selectNo=sNumb;
// put object items list into next select box after clearing
targetObj=document.getElementById("select_"+selectNo)
targetObj.disabled=false;
// clear any existing options note that this starts from end of list, not beginning
for(var i=targetObj.options.length-1;i>-1;i--)
{ targetObj.options[i]=null; }
// build in short delay here to avoid error in Opera browser
setTimeout("finishOff()",50)
}
// ----------- 50ms delay here --------
// called from timeout in function process()
function finishOff()
{ var obj=saveObj; // from global
// fill selectObj options
var i, thisItem=0;
// build options list
switch(selectNo){
case 2 : targArray = A[obj.options[indx].value]; break;
}
//
for(i=0;i<targArray.length;i++)
{ thisItem=targArray[i];
// syntax is new Option("text", "value", isDefaultSelectedFlag, isSelectedFlag)
targetObj.options[i]=new Option(thisItem,thisItem,false,false);
}
obj.blur();
}
// ============ end process() ===================
// fires on selecting in third select box
function finish()
{ select("["+selectObj1.value+"] ["+selectObj2.value+"]")
}
// ------------
//
window.onload=init;
//-->
</script>