求一个下拉级联的demo
求一个下拉级联的demo ,记得easyui 好像有那么个例子,没有找到,
[解决办法]
下拉
[解决办法]
<%@ page language="java" import="java.util.*" pageEncoding="GB18030"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>下拉菜单的二级联动</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
<script language="javascript" type="text/javascript">
var bookname=[
["sql server技术大全","java web开发大全","c#开发大全","php开发大全"],
["美容瘦身","家庭菜谱","热情火锅","家常汤粥"],
["法律基础","法律案例探究","法律的理念","法律帝国"],
["现代汉英词典","写作教程","阅读教程","回话教程","听力教程"],
["不生病的智慧","这样吃最健康","求医不如求己","从头到脚说健康"]
];
function getName(){
var bookcatagory=document.forms["form1"].elements["catagory"];
var bookNameObj=document.forms["form1"].elements["bookname"];
var catagoryCity=bookname[bookcatagory.selectedIndex-1];
bookNameObj.length=1;
for(var i=0;i<catagoryCity.length;i++){
bookNameObj[i+1]=new Option(catagoryCity[i]);
}
}
</script>
</head>
<body>
<h3>下拉菜单的二级联动</h3>
<form action="" name="form1" >
<select name="catagory" onchange="getName()">
<option value="0">请选择图书类别</option>
<option value="1">一级</option>
<option value="2">二级</option>
<option value="3">三级</option>
<option value="4">四级</option>
<option value="5">五级</option>
</select>
<select name="bookname">
<option value="0">请选择图书名称</option>
</select>
</form>
</body>
</html>