MrMuggles31
Technical User
This question really should be an easy one to answer, but for the life of me, I cannot figure out what to search for in Google, nor how to code it. Here is the situation -
I have an HTML file that has a JavaScript drop down list. The JavaScript file is:
Pretty simple stuff. The HTML file just has this JS added where I want the drop down to show up.
The question is - now that I have a drop down list, how can I add a Next, Previous, and Home button that goes to the next or previous option on the list, or to the first option when the user clicks Home? So if the user is on Third, they would click on Next, it would go to Fourth, click on previous it would go to Second, or click Home and it would go to First. Obviously putting goforward or goback would not work because that would put the user forward or back based on there browsing history. I want it to be tied into the list. Any ideas? Any websites I can visit that has a good example of this? I am hoping the issue is an easy solution. Thank you all in advance.
I have an HTML file that has a JavaScript drop down list. The JavaScript file is:
Code:
function menu_goto( menuform )
{
var baseurl = '[URL unfurl="true"]http://www.cnn.com/'[/URL] ;
selecteditem = menuform.url.selectedIndex ;
newurl = menuform.url.options[ selecteditem ].value ;
if (newurl.length != 0) {
location.href = baseurl + newurl ;
}
}
document.writeln( '<form action="chgoto" method="get">' );
document.writeln( '<select name="url" onchange="menu_goto(this.form)">' );
document.writeln( '<option value="01.html">First</option>' );
document.writeln( '<option value="02.html">Second</option>' );
document.writeln( '<option value="03.html">Third</option>' );
document.writeln( '<option value="04.html">Fourth</option>' );
document.writeln( '<option value="05.html">Fifth</option>' );
document.writeln( '</select>' );
document.writeln( '</form>' );
The question is - now that I have a drop down list, how can I add a Next, Previous, and Home button that goes to the next or previous option on the list, or to the first option when the user clicks Home? So if the user is on Third, they would click on Next, it would go to Fourth, click on previous it would go to Second, or click Home and it would go to First. Obviously putting goforward or goback would not work because that would put the user forward or back based on there browsing history. I want it to be tied into the list. Any ideas? Any websites I can visit that has a good example of this? I am hoping the issue is an easy solution. Thank you all in advance.