PDA

View Full Version : externalize a page jumping routine



tpeck
10-17-2005, 12:35 AM
Hi. Is there a way to externalize a page jumping routine such as the one the below? At the moment it has 100 options and exists on 100 pages:

<form name="form">
<select name="site" size="1" onchange="MM_jumpMenu('parent',this,0)">
<option value></option>
<option value="page1.html">1</option>
<option value="page2.html">2</option>
<option value="page2.html">3</option>
....etc.
</form>

Thanks,

Terry

martin_narg
10-17-2005, 01:46 AM
Your html page:

<form name="form">
<select name="site" size="1" onchange="jump(this);">
<option value></option>
<option value="page1.html">1</option>
<option value="page2.html">2</option>
<option value="page2.html">3</option>
</form>
Your external js page:

function jump(obj) {
if(obj.selectedIndex > 0) {
document.location.href = obj[obj.selectedIndex].value;
}
}
hope this helps

m_n

tpeck
10-17-2005, 03:23 AM
Yes, thanks - it's better than what I have at the moment, but it still requires a 100 lines (for the 100 pages) in each page.

Is there no other option? I'll use what you've given me over my routine though.