为了创建折叠式的导航菜单,你可以在网页的最前面部分以下代码:
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function formHandler()
{
var URL = document.form.site.options
[document.form.site.selectedIndex].value;
window.location.href = URL;
// End -->
}
</SCRIPT>
那在网页上如何调用呢?以下是具体代码:
<CENTER>
<FORM name = "form">
<SELECT NAME="site" SIZE=1 onChange ="formHandler()">
<OPTION VALUE="">连接到….
<OPTION VALUE="http://www.pconline.com.cn">太平洋电脑网
<OPTION VALUE="http://cn.yahoo.com">中文雅虎
<OPTION VALUE="263">http://www.263.net">263网站
<OPTION VALUE="http://www.usnews.com">美国在线
<OPTION VALUE="http://www.neworiental.org">北京新东方
</SELECT>
</FORM>
</CENTER>
下面是全部的代码:
NPaLinux联盟
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<SCRIPT LANGUAGE="JavaScript">
NPaLinux联盟
<!-- Begin
NPaLinux联盟
function formHandler()
NPaLinux联盟
{
NPaLinux联盟
var URL = document.form.site.options
NPaLinux联盟
[document.form.site.selectedIndex].value;
NPaLinux联盟
window.location.href = URL;
NPaLinux联盟
// End -->
NPaLinux联盟
}
NPaLinux联盟
</SCRIPT>
</head>
NPaLinux联盟
<FORM name = "form">
NPaLinux联盟
<SELECT NAME="site" SIZE=1 onChange ="formHandler()">
<option value="">连接到…. </option>
<option value="http://www.pcedu.com.cn">太平洋网络学院</option>
<option value="http://cn.yahoo.com">中文雅虎 </option>
<option value="263">http://www.263.net">263网站 </option>
<option value="http://www.usnews.com">美国在线 </option>
<option value="http://www.neworiental.org">北京新东方 </option>
</SELECT>
NPaLinux联盟
</FORM>
NPaLinux联盟
效果实现:
Linux联盟收集整理 ,转贴请标明原始链接,如有任何疑问欢迎来本站Linux论坛讨论