November 30, 2000 - Printing the Selected Item | WebReference

November 30, 2000 - Printing the Selected Item

Yehuda Shiran November 30, 2000
Printing the Selected Item
Tips: November 2000

Yehuda Shiran, Ph.D.
Doc JavaScript

One of the advantages of Netscape 6 over Internet Explorer is the ability to print the selected item of a SELECT element. The following drop down menu includes two entries, Al Gore and George W. Bush. Here is the HTML code for this menu:

<SELECT name="presidents">
<OPTION>Al Gore
<OPTION SELECTED>George W. Bush
</SELECT>

The button on the right hand side triggers a call to:

alert(document.election.presidents.value)

Try changing the selection in the drop-down menu. Click the button. In Internet Explorer, the alert box will show up empty. In Netscape 6, the alert box will echo your selection.