有一个下拉框里面的列表值为服装、食品、运动
服装:□运动服 □T衬 □牛仔裤 □背心 □外套
食品:□零食 □汽水 □保健品
运动:□运动器材 □运动鞋 □运动服 □帽子 □运动包
还有一个用来显示上面内容的textarea
---------------------------------------------------
当选择服装的时候,服装下面的值就显示出来,当选中运动服的时候,运动服就直接加入到textarea中...
当选择食品的时候,食品下面的值就显示出来,当选中零食的时候,零食就直接加入到textarea中...
相对的后面也是这样....
----------------------------------------------------
类似于2级联动效果.....(只是把二级栏目的下拉框改为几个复选框,然后在textarea中显示)(我不知道说得清不清楚,请各位多多指教)
服装:□运动服 □T衬 □牛仔裤 □背心 □外套
食品:□零食 □汽水 □保健品
运动:□运动器材 □运动鞋 □运动服 □帽子 □运动包
还有一个用来显示上面内容的textarea
---------------------------------------------------
当选择服装的时候,服装下面的值就显示出来,当选中运动服的时候,运动服就直接加入到textarea中...
当选择食品的时候,食品下面的值就显示出来,当选中零食的时候,零食就直接加入到textarea中...
相对的后面也是这样....
----------------------------------------------------
类似于2级联动效果.....(只是把二级栏目的下拉框改为几个复选框,然后在textarea中显示)(我不知道说得清不清楚,请各位多多指教)
1、初始的时候,有一个下拉框,里面是一级菜单;对应有N个显示隐藏的DIV,里面是二级菜单的多选框,还有一个文本框显示内容
2、SELECT的onchange触发后,做4个动作:隐藏之前为显示状态的二级菜单DIV;显示选中的二级菜单DIV;清空文本框内容;根据当前二级菜单选择项来初始文本框的内容
3、多选框的onclick触发后,如果选中,判断是否文本框内容中已经有该选项,没有就添加;如果是取消选中,清除文本框内容中对应部分
function fillText(){
txt.value = "";
obj = document.all("box");
for (var i=0; i<obj.length; i++)
if (obj[i].checked)
txt.value += (txt.value==""?"":",") + obj[i].value;
}
</script>
服装:<input name=box type=checkbox value="运动服" onclick="fillText()">运动服 <input name=box type=checkbox value="T衬" onclick="fillText()">T衬 <input name=box type=checkbox value="牛仔裤" onclick="fillText()">牛仔裤 <input name=box type=checkbox value="背心" onclick="fillText()">背心 <input name=box type=checkbox value="外套" onclick="fillText()">外套<br>
食品:<input name=box type=checkbox value="零食" onclick="fillText()">零食 <input name=box type=checkbox value="汽水" onclick="fillText()">汽水 <input name=box type=checkbox value="牛仔裤" onclick="fillText()">保健品<br>
运动:<input name=box type=checkbox value="运动器材" onclick="fillText()">运动器材 <input name=box type=checkbox value="运动鞋" onclick="fillText()">运动鞋 <input name=box type=checkbox value="运动服" onclick="fillText()">运动服 <input name=box type=checkbox value="帽子" onclick="fillText()">帽子 <input name=box type=checkbox value="运动包" onclick="fillText()">运动包<br><textarea id="txt" cols=20 rols=10>
</textarea>
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<script language="JavaScript" type="text/JavaScript">
<!--
function showadv(){
if (document.theForm.checkbox.checked == true) {
document.getElementById("hello").style.display = "";
document.getElementById("adv").innerText="关闭选项";
}
else{
document.getElementById("hello").style.display = "none";
document.getElementById("adv").innerText="显示选项";
}
}
//-->
</script>
</head><body>
<form name="theForm">
<table width="100%" border="0" cellspacing="0" cellpadding="0" >
<tr>
<td width="2%" ><input type="checkbox" name="checkbox" value="checkbox" onclick=showadv()></td>
<td width="98%" align="left" id="adv">显示选项</td>
</tr>
<tr>
<td colspan="2" >
<table width="100%" height="214" border="1" cellpadding="0" cellspacing="0" id="hello" name="hello" style="display:none">
<tr>
<td>shshs</td>
</tr>
</table> </td>
</tr>
</table>
</form>
</body>
</html>
----------------------------
怎么只有一半呀~!上面的都没有的~!
我不是很懂喔~!请多多指教....