You are here: irt.org | FAQ | JavaScript | Frame | Q532 [ previous next ]
Use relative references for the local files and absolute references for the remote files:
<script language="JavaScript1.2"><!--
function surfto(selectlist) {
var url = selectlist.options[selectlist.selectedIndex].value
if (url != '') {
if (url.indexOf('http://') > -1)
top.location.href = url;
else
location.href = url;
}
}
//--></script>
<form>
<select name="myOption" onChange="surfto(this)">
<option value="">Choose One:
<option value="local.htm">Local Page
<option value="http://www.somewhere.com/">Remote Page
</select>