| |
|
|
| | Есть 2 одинаковых выпадающих списка. При выборе элемента в одном из них в другом этот элемент не должен отображаться. Как это сделать? HELP!!! | |
| |
|
|
| |
|
|
| |
для: helce
(27.03.2007 в 12:34)
| | | я честно говоря так никогда не делал... но... вот так не будет работать?
<select id='s1' onChange='prepare(this.value,2)'>
<select id='s2' onChange='prepare(this.value,1)'>
<script>
function prepare (value, n)
{
var s = document.getElementById ('s'+n);
for (var o in s.options)
{
s.options[o].style.display = (o==value)
? 'none' : 'block';
}
}
</script>
|
| |
| |
|
|
| |
|
|
| |
для: bronenos
(27.03.2007 в 13:02)
| | | Не работает. Но все равно спасибо | |
| |
|
|
| |
|
|
| |
для: helce
(27.03.2007 в 12:34)
| | | Смешная задачка :-)
<head>
<script>//MSIE6, Opera8
function myFunc (a)
{
if (!a.selectedIndex) return;
with (document) var obj = (a.id == 's1') ? getElementById ('s2') : getElementById ('s1');
for (var opt = [], j = 1; j < obj.options.length; j++) opt [obj.options [j].text] = j;
if (!opt [a.options [a.selectedIndex].text]) return;
obj.options.remove (opt [a.options [a.selectedIndex].text]);
}
</script>
</head>
<body>
<select size="7" id="s1" style="width: 100" onchange="myFunc (this)">
<option style="color: red">Select 1
<option>A
<option>BB
<option>CCC
<option>DDDD
<option>EEEEE
<option>FFFFFF
</select>
<select size="7" id="s2" style="width: 100; margin-left: 30" onchange="myFunc (this)">
<option style="color: red">Select 2
<option>A
<option>BB
<option>CCC
<option>DDDD
<option>EEEEE
<option>FFFFFF
</select>
</body>
|
| |
| |
|
|