Комментарии:
It works thank you so much
Ответить<!DOCTYPE html>
<html>
<head>
<title>Multiple Selection</title>
</head>
<body>
<form action="/" method="post" name="myform">
<input type="checkbox" name="chk_all" onchange="checkall()" value=""> Select All
<hr>
<input type="checkbox" name="chk_1" value=""> Check1
<input type="checkbox" name="chk_2" value=""> Check2
<input type="checkbox" name="chk_3" value=""> Check3
<input type="checkbox" name="chk_4" value=""> Check4
<input type="checkbox" name="chk_5" value=""> Check5
<input type="text" name="name">
</form>
<script type="text/javascript">
function checkall()
{
var total_element = document.forms[0].elements.length;
//alert(total_element); //it returns no. of elements..
for (var i = 0; i < total_element; i++)
{
var elementsname =document.forms[0].elements[i].name;
//alert(elementsname); // it returns the name of elements
if (elementsname!=undefined && elementsname.indexOf('chk_')!=-1)
{
document.forms[0].elements[i].checked=document.myform.chk_all.checked;
}
}
}
</script>
</body>
</html>
sir, your code is working but, if we want to use more than one ( multiple chekcboxes) in table then who to apply this code
Ответитьcannot find the source code? could you please post the exact link to the source code for this tutorial please thankyou
Ответитьvery nice.. useful example..
Ответить