Image Caption
Showing posts with label HTML. Show all posts
Showing posts with label HTML. Show all posts

Tuesday, January 24, 2012

check uncheck all checkboxes javascript

<SCRIPT LANGUAGE="JavaScript">
function checkbox (field) {
for (i = 0; i < field.length; i++) {
if(field[i].checked == true) {
uncheckAll(field);
}
else {
checkAll(field);
}
}
}
function checkAll(field)
{
for (i = 0; i < field.length; i++)
field[i].checked = true ;
}

function uncheckAll(field)
{
for (i = 0; i < field.length; i++)
field[i].checked = false ;
}

</script>

<form name="myform" action="checkboxselect.php" method="post">
<b>Your Favorite Scripts & Languages</b><br>
<input type="checkbox" id="list1" name="list[]" value="1">Java<br>
<input type="checkbox" id="list1"name="list[]" value="2">Javascript<br>
<input type="checkbox" id="list1" name="list[]" value="3">Active<br>
<input type="checkbox" id="list1" name="list[]" value="4">HTML<br>
<input type="checkbox" id="list1" name="list[]" value="5">SQL<br>

<input type="checkbox" name="CheckAll" value="Check All"
 onClick="checkbox(document.myform.list1)">Select all<br>
<input type="submit" value="submit">
<?php echo $listvalue =$_REQUEST['list'];
while (list ($key,$val) = @each ($listvalue)) {
echo "$val,";
}
?>
<br>
</form>

Monday, January 23, 2012

Autofill input field with value another field

<html>
<head>
<script type="text/javascript" language="JavaScript" >
function changeVal() {
s1 = new String(contact.inputone.value);
document.contact.inputtwo.value = s1;
}
</script>
</head>
<body>
<BR>
<BR>
<form name="contact">
Input:
<input type="text" name="inputone" value="" onkeyup = "changeVal()">
<br/>
Auto :
<input type="text"  name="inputtwo" value="">
</form>
</body>
</html>