How do I set the option selected in a jumpmenu when using a dwt template to create the menu on multiple pages?
Currently. when I change the page, it always restores back to the initial option (page 1), even when I have 'restore' set to 0. What I want it to do is stay at what I selected, even after it changes the page (ie. when I select page 2 I want the jum menu to indicate Page 2, even after it refreshes to Page 2).
Here's the code:
FIRST: THE TEMPLATE USED TO CREATE THE PAGES:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- TemplateBeginEditable name="doctitle" -->
<title>Main Template</title>
<!-- TemplateEndEditable -->
<SCRIPT language="JavaScript" SRC="jumpmenuscript.js"></SCRIPT>
</head>
<body>
<form name="form" id="form">
<select name="jumpMenu" id="jumpMenu">
<option value="../Try/page_1.html">page_1</option>
<option value="../Try/page_2.html">page_2</option>
</select>
<input type="button" name="go_button" id= "go_button" value="Go" onclick="MM_jumpMenuGo('jumpMenu','parent',0)" />
</form>
<!-- TemplateBeginEditable name="Page Identifier" -->
<!-- TemplateEndEditable -->
</body>
</html>
NEXT, AN EXAMPLE PAGE (BOTH PAGES ARE IDENTICAL, EXCEPT FOR THE HEADING)
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>Main Template</title>
<!-- InstanceEndEditable -->
<SCRIPT language="JavaScript" SRC="jumpmenuscript.js"></SCRIPT>
</head>
<body>
<form name="form" id="form">
<select name="jumpMenu" id="jumpMenu">
<option value="../Try/page_1.html">page_1</option>
<option value="../Try/page_2.html">page_2</option>
</select>
<input type="button" name="go_button" id= "go_button" value="Go" onclick="MM_jumpMenuGo('jumpMenu','parent',0)" />
</form>
<!-- InstanceBeginEditable name="Page Identifier" -->
<h1>This is Page 1</h1>
<!-- InstanceEndEditable -->
</body>
<!-- InstanceEnd --></html>
FINALLY, THE JAVASCRIPT: // JavaScript Document
function MM_jumpMenuGo(objId,targ,restore){ //v9.0
var selObj = null; with (document) {
if (getElementById) selObj = getElementById(objId);
if (selObj) eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0; }
}