81,092
社区成员
发帖
与我相关
我的任务
分享
<select name="myClient" onchange="selectOnChenge('my')">
<option value="" selected="selected">myClient</option>
<c:forEach items='${myGroupList}' var='groupId'>
<option name="clientOption" value="${groupId}">${groupId}</option>
</c:forEach>
</select>
<select id="allClient" name="allClient" onChenge="selectOnChenge('all')">
<option value="" selected="selected">allClient</option>
<c:forEach items='${allGroupList}' var='groupId'>
<option name="clientOption" value="${groupId}">${groupId}</option>
</c:forEach>
</select>
<SCRIPT LANGUAGE="JavaScript">
function selectOnChenge(client){
if(client = 'my'){
var allclient = document.getElementById('allClient');
var option=allclient.getElementsByTagName("option");
var str = "" ;
document.getElementsByName('allClient').value =option[0].value;
document.getElementsByName('allClient').text = option[0].text;
selected = 'selected';
}
}
</SCRIPT>
<html>
<head>
<script type="text/javascript">
function selectOnChenge(client){
if(client == 'my'){
var allclient = document.getElementById('allClient');
allclient.value='1';
}
}
</script>
</head>
<body>
<select id="myClient" onchange="selectOnChenge('my');"><option value="0">显示所有回复</option><option value="1">显示星级回复</option><option value="2">显示楼主回复</option></select>
<select id="allClient" onchange="selectOnChenge('all');"><option value="0">显示所有回复</option><option value="1">all</option><option value="2">显示楼主回复</option></select>
</body>
</html>
<html>
<body>
<select name="myClient" onchange="selectOnChenge('my')">
<option value="" selected="selected">myClient</option>
<option name="clientOption" value="1">1</option>
<option name="clientOption" value="2">2</option>
<option name="clientOption" value="3">3</option>
</select>
<select id="allClient" name="allClient" onChange="selectOnChenge('all')">
<option value="" selected="selected">allClient</option>
<option name="clientOption" value="1">1</option>
<option name="clientOption" value="2">2</option>
<option name="clientOption" value="3">3</option>
</select>
</body>
<SCRIPT LANGUAGE="JavaScript">
function selectOnChenge(client)
{
var allclient = document.getElementById('allClient');
var myClient = document.getElementById('myClient');
if(client == 'my')
{
if (myClient.selectedIndex > 0)
{
allclient.value = "";
}
}
else if (client == 'all')
{
if (allclient.selectedIndex > 0)
{
myClient.value = "";
}
}
}
</SCRIPT>
</html>
<select name="myClient" onchange="selectOnChenge('my',this.form.allClient)">
。。。。。
js方法:
function selectOnChenge(client,allclient){
if(client == 'my'){
var allclient = document.getElementById('allClient');
var option=allclient.getElementsByTagName("option");
allclient.value =option[0].value;
allclient.text = option[0].text;
selected = 'selected';
}
}