下面是全部的代码:
1<head>
2<title>Untitled Document</title>
3<meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
4<script language="JavaScript">
5
6
7
8
9<!-- Begin
10
11
12
13
14function formHandler()
15
16
17
18
19{
20
21
22
23
24var URL = document.form.site.options
25
26
27
28
29[document.form.site.selectedIndex].value;
30
31
32
33
34window.location.href = URL;
35
36
37
38
39// End -->
40
41
42
43
44}
45
46
47
48
49</script>
50</head>
1<form name="form">
2<select name="site" onchange="formHandler()" size="1">
3<option value="">连接到…. </option>
4<option value="http://www.pcedu.com.cn">太平洋网络学院</option>
5<option value="http://cn.yahoo.com">中文雅虎 </option>
6<option value="http://www.263.net">263网站 </option>
7<option value="http://www.usnews.com">美国在线 </option>
8<option value="http://www.neworiental.org">北京新东方 </option>
9</select>
10</form>
效果实现:
连接到…. 太平洋网络学院 中文雅虎 163邮箱 美国在线 javascript教程