Displaying Source Code(s)
|
|
--------------------------------------------------------------------------------
Highlight Selection (CheckBox)
--------------------------------------------------------------------------------
Description : This is a simple script to highlight the selected
checkboxes with Yellow Background
<html>
<head><title>Welcome</title>
<script language="javascript">
<!--
function sel(ct)
{
if(ct.checked)
{
var n,e
n=ct.name
e=document.getElementById(n)
e.style.background="yellow"
}
else
{
var n,e
n=ct.name
e=document.getElementById(n)
e.style.background="white"
}
}
//-->
</script>
</head>
<body>
<form name="frm1">
<table>
<tr id="chk1">
<td><input type="checkbox" name="chk1" onclick="sel(this)">America</td>
</tr>
<tr id="chk2">
<td><input type="checkbox" name="chk2" onclick="sel(this)">India</td>
</tr>
<tr id="chk3">
<td><input type="checkbox" name="chk3" onclick="sel(this)">Japan</td>
</tr>
<tr id="chk4">
<td ><input type="checkbox" name="chk4" onclick="sel(this)">London</td>
</tr>
</table>
</form>
</body>
</html> |
|
|