Форум: Форум PHPФорум ApacheФорум Регулярные ВыраженияФорум MySQLHTML+CSS+JavaScriptФорум FlashРазное
Новые темы: 0000000
PHP Puzzles. Авторы: Кузнецов М.В., Симдянов И.В. Социальная инженерия и социальные хакеры. Авторы: Кузнецов М.В., Симдянов И.В. PHP 5. На примерах. Авторы: Кузнецов М.В., Симдянов И.В., Голышев С.В. Самоучитель MySQL 5. Авторы: Кузнецов М.В., Симдянов И.В. C++. Мастер-класс в задачах и примерах. Авторы: Кузнецов М.В., Симдянов И.В.
ВСЕ НАШИ КНИГИ
Консультационный центр SoftTime

HTML+CSS+JavaScript

Выбрать другой форум

 

Здравствуйте, Посетитель!

вид форума:
Линейный форум Структурный форум

тема: Появление разных полей
 
 автор: helovek   (17.08.2008 в 08:40)   письмо автору
 
 

Помогите тразобраться с видимостью полей при выборе значения
[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>&nbsp;Фрукты<br>
<input type=Radio name=tropos onclick="show('inf');" value=cred CLASS=expandable child=info>Овощи&nbsp;<br>
<input type=Radio name=tropos onclick="show('inf');" value=cred CLASS=expandable child=info>&nbsp;Все вместе&nbsp;<br>
</div>
<DIV ID=inf style="display:'none'; width: 350;"><b>* <input type=text name=Period size=2>&nbsp;Персики</b> &nbsp;&nbsp;
</DIV>
<DIV ID=inf style="display:'none'; width: 350;"><b>* <input type=text name=Per size=2>&nbsp;Яблоки</b> &nbsp;&nbsp;
</DIV>
<DIV ID=inf style="display:'none'; width: 350;"><b>* <input type=text name=Peri size=2>&nbsp;Картофель</b> &nbsp;&nbsp;
</DIV>
<DIV ID=inf style="display:'none'; width: 350;"><b>* <input type=text name=Perio size=2>&nbsp;Капуста</b> &nbsp;&nbsp;
</DIV>
</td>
</tr>
</table>
/code]

  Ответить  
 
 автор: mikha   (17.08.2008 в 16:37)   письмо автору
 
   для: 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>

Убей не пойму зачем это нужно..

  Ответить  
 
 автор: helovek   (17.08.2008 в 21:32)   письмо автору
 
   для: mikha   (17.08.2008 в 16:37)
 

Спасибо друг.

  Ответить  
Rambler's Top100
вверх

Rambler's Top100 Яндекс.Метрика Яндекс цитирования