Making a JumpList Combo Box
Problem 6: How do I create a drop down box with hyperlinks attached to each member of the list box so that clicking an item causes the browser to navigate to the associated link?
There are a number of ways to create a JumpList box, ranging from using arrays to managing the links directly in the drop down box. Here are the extremes:
Using Arrays and Object Oriented Programming:
var args = jumpArray.arguments;
for(var i=0; i<args.length; i++)
this[i] = args[i];
this.length = args.length;
var labels = new jumpArray('Select a Search Engine',
var urls = new jumpArray ('','http://www.yahoo.com',
i = form.JumpList.selectedIndex;
window.location.href = urls[i];
<!-- The select control will appear
wherever you place the following script.
for(var i=0;i<labels.length; i++)
document.write('<option>' + labels[i]);
Here's another version that manages the URLs and Labels in the <select> element:
<select size="1" name="jumpList"
<option>Choose a Search Engine</option>
A slightly more advanced version (left up to you to implement) is to rewrite the object oriented JumpList code so it uses a single array rather than separate arrays for text and URLs (Hint—each item in the array can be assigned any necessary properties).