Yeah wrote:
> I wish to use a drop box where each Option will not take the user to a web
> page - but a certain location on the same page the drop box exists. For
> example, Option 1 would take the user to "Chapter 1", Option 2 would be
> "Chapter 2", and so on. All destinations are on the same page.
>
> I already have <A NAME="#ChapterX"> tags placed in the appropriate places
> in the document. (A no-GO button drop box is preferred.)
>
> How do I achieve this?
Try this...
In <head>:
<script type="text/javascript">
function formHandler(form){
var URL =
document.form.site.options[document.form.site.selectedIndex].value;
window.location.href = URL;
}
</script>
In <body>:
<form name="form">
<select name="site" onChange="javascript:formHandler()">
<option value="index.html#chaper1">Chapter 1
<option value="index.html#chaper2">Chapter 2
</select>
</form>
Also:
<A NAME="#chapter1">Chapter 1</A>
...
<A NAME="#Chapter2">Chapter 2</A>
...
I can confirm that it works properly in all major modern browsers.
Roy
--
Roy S. Schestowitz
http://Schestowitz.com
|
|