HTML and CSS Reference
In-Depth Information
Table 9-21 Code to Change the Browser Scroll Bar Color
function scrollColor() {
The following step enters the user-defined function to change the browser scroll bar color in the <head>
If necessary, click
blank line 26.
Enter the JavaScript
code shown in
Table 9-21.
scrollColor() function changes color of
browser scroll bar and scroll bar track
to yellow and gold, respectively
Press the
e n t e r key
twice after the last }
to leave a blank
line between user-
defined functions
(Figure 9-8).
insertion point after
pressing ENTER key twice
Figure 9-8
Using the select list as a drop-down menu.
To use a <select> list as a drop-down menu, a user-defined function must make use of the
The window's location property (window.location), to which a URL can be assigned,
and which changes the location of the Web page in the browser.
The selectedIndex property to identify which item was selected from the drop-down menu.
Using the selectedIndex Property and the
Location Object to Link to a New URL
As shown in Figure 9-1 on page HTML 411, the Midwest Bridal Expo Web page
also includes a <select> list that allows users to select items from a drop-down menu.
Depending on the item chosen in the select list, the code will link users to one of three
Web pages containing a vendor list, the schedule, or wedding tips.
When a user selects an item in the select list, the selectedIndex property of the
select list returns the value of the selected item, which in this case is a URL of another
Web page. The selectedIndex values of the items in a select list are considered to be num-
bered, starting with zero for the first item. The second item is number one, and so on.
Table 9-22 shows the general form of the selectedIndex property.
The selectedIndex
The selectedIndex
property cannot be used
alone; it must be used
in full reference to the
particular select list, the
form it belongs to, and its
Search WWH ::

Custom Search