就是在一个下拉列表里的选择其他选项 后面出现一个文本框输入值 这个该怎么做
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<body>
<select name="select">
<option selected="selected">猪</option>
<option>鸡</option>
<option>鸭</option>
<option>鹅</option>
<option>鸽子</option>
<option>鹌鹑</option>
<option>牛</option>
<option>羊</option>
<option>其他</option>
</select>
</body>
</html>
最近需要做个有很多联动下拉列表的表单 哪位大哥有能在一个表单里重复使用多次的无限级下拉列表
我现在用的联动下拉列表是这个http://bbs.blueidea.com/thread-2285998-1-1.html 不过要重复使用的话 得把JS重新复制更改一遍 有没有更简洁一点
另外我这个联动下拉列表是读数据库里的信息 用哪种方式做比较好 JS的还是AJAX的 后台是JSP的
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<body>
<select name="select">
<option selected="selected">猪</option>
<option>鸡</option>
<option>鸭</option>
<option>鹅</option>
<option>鸽子</option>
<option>鹌鹑</option>
<option>牛</option>
<option>羊</option>
<option>其他</option>
</select>
</body>
</html>
最近需要做个有很多联动下拉列表的表单 哪位大哥有能在一个表单里重复使用多次的无限级下拉列表
我现在用的联动下拉列表是这个http://bbs.blueidea.com/thread-2285998-1-1.html 不过要重复使用的话 得把JS重新复制更改一遍 有没有更简洁一点
另外我这个联动下拉列表是读数据库里的信息 用哪种方式做比较好 JS的还是AJAX的 后台是JSP的
這個是用js實現的,沒有從數據里查詢數據動作
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>test</title>
<script src="jquery-1.3.2.js"></script>
<script>
$(function(){
$("select").change(function(){
$("option").each(function(){
if($(this).is(":selected")){
var value = $(this).text();
$("#input").attr("value", value);
}
});
});
});
</script>
</head><body>
<select name="select">
<option selected="selected">猪</option>
<option>鸡</option>
<option>鸭</option>
<option>鹅</option>
<option>鸽子</option>
<option>鹌鹑</option>
<option>牛</option>
<option>羊</option>
<option>其他</option>
</select>
<input type="text" id="input" value="" />
</body>
</html>是这样吗?
就是列表选项是“其他”时 后面显示一个文本框输入值进行传递