|
|
|
| Помогите тразобраться с видимостью полей при выборе значения
[code][ <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
<!--
// set the visibility of an object to visible
function show(obj) {
var theObj = document.getElementById(obj).style;
theObj.display = "block";
}
// set the visibility of an object to hidden
function hide(obj) {
var theObj = document.getElementById(obj).style;
theObj.display = "none";
}
-->
</script>
<table>
<tr>
<div><td bgcolor=dff5ff><b>*Выбрать:</b></td>
<TD width=250 bgcolor=dff5ff>
<input type=radio name=tropos onclick="show('info');" value=cash> Фрукты<br>
<input type=Radio name=tropos onclick="show('inf');" value=cred CLASS=expandable child=info>Овощи <br>
<input type=Radio name=tropos onclick="show('inf');" value=cred CLASS=expandable child=info> Все вместе <br>
</div>
<DIV ID=inf style="display:'none'; width: 350;"><b>* <input type=text name=Period size=2> Персики</b>
</DIV>
<DIV ID=inf style="display:'none'; width: 350;"><b>* <input type=text name=Per size=2> Яблоки</b>
</DIV>
<DIV ID=inf style="display:'none'; width: 350;"><b>* <input type=text name=Peri size=2> Картофель</b>
</DIV>
<DIV ID=inf style="display:'none'; width: 350;"><b>* <input type=text name=Perio size=2> Капуста</b>
</DIV>
</td>
</tr>
</table>
/code] | |
|
|
|
|
|
|
|
для: helovek
(17.08.2008 в 08:40)
| |
<!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=windows-1251" />
<script type="text/javascript">
function doBlock(id){
document.getElementById(id).style.display='block';
}
function doNone(id){
document.getElementById(id).style.display='none';
}
function doHidden(){
doNone('inf0'); doNone('inf1'); doNone('inf2'); doNone('inf3');
}
function doRadioCash(){
doHidden(); doBlock('inf0'); doBlock('inf1');
}
function doRadioCred(){
doHidden(); doBlock('inf2'); doBlock('inf3');
}
function doRadioAll(){
doBlock('inf0'); doBlock('inf1'); doBlock('inf2'); doBlock('inf3');
}
</script>
<style type="text/css">
<!--
.tab_{
background-color:#dff5ff;
border:#CCCCCC 1px solid;
}
.tab_ div{
display:none;
margin-bottom:2px;
}
-->
</style>
<title>title</title>
</head>
<body>
<table class="tab_">
<tr>
<td style="vertical-align:top;"><strong>*Выбрать:</strong></td>
<td style="width:250px;">
<label for="r0"><input id="r0" type="radio" name="tropos" onclick="doRadioCash();" value="cash" /> Фрукты</label><br />
<label for="r1"><input id="r1" type="radio" name="tropos" onclick="doRadioCred();" value="cred" /> Овощи</label><br />
<label for="r2"><input id="r2" type="radio" name="tropos" onclick="doRadioAll();" value="cred" /> Все вместе</label>
<div id="inf0"><input type="text" name="Period" size="2" /> Персики</div>
<div id="inf1"><input type="text" name="Per" size="2" /> Яблоки</div>
<div id="inf2"><input type="text" name="Peri" size="2" /> Картофель</div>
<div id="inf3"><input type="text" name="Perio" size="2" /> Капуста</div></td>
</tr>
</table>
</body>
</html>
|
Убей не пойму зачем это нужно.. | |
|
|
|
|
|
|
|
для: mikha
(17.08.2008 в 16:37)
| | Спасибо друг. | |
|
|
|