Показать сообщение отдельно
  #9 (permalink)  
Старый 13.04.2015, 09:34
Кандидат Javascript-наук
Посмотреть профиль Найти все сообщения от theKingOfJava
 
Регистрация: 31.03.2015
Сообщений: 113

Если я правильно понял
<html>
<head>
</head>
<body>
 
<p><table id="t" width="1250" cellspacing="1" cellpadding="2" style="border: 1px solid black">
<tr>
<td>ID</td>
<td>Full Name</td>
<td>Reading Hall</td>
<td>Registration</td>
<td>Expiration Date</td>
<td>Period</td>
</tr>
</table></p>
 
<fieldset>
<legend>New Reader</legend> <label>Reader`s ID</label> <input id="ID"/> <button id="gen">generate id</button>
<p><label>Full Name</label> <input id="fullName" /></p>
<label>Reading Hall</label> <select id="RH">
<option>Financial</option>
<option>Computers/IT</option>
<option>Science Fiction</option>
<option selected>--Select reading hall--</option>
</select>
<p><label>Registration date</label> <input id="Registration_date"/></p>
<p><label>Registration month</label> <select id="Registration_month"><option>01</option><option>02</option></select> </p>
<p><label>Registration year</label> <select id="Registration_year"><option>2000</option><option>2001</option></select> </p>
<p> <button id="b">Add reader to table</button></p>
</fieldset>
 
 
<script>
gen.onclick=function(){
ID.value=Math.floor(Math.random()*20)
}
 
b.onclick=function(){
 var row=t.insertRow()
 row.insertCell().innerHTML=ID.value
 row.insertCell().innerHTML=fullName.value
 row.insertCell().innerHTML=RH.value
 row.insertCell().innerHTML=Registration_date.value+" "+Registration_month.value+" "+Registration_year.value
}
</script>
</body>
 
</html>
Ответить с цитированием