<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Test.aspx.cs"
Inherits="Test" %>
<!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 runat="server">
<title></title>
<script type="text/javascript" >
function srinu() {
var i;
var count = 0;
for (i = 1; i <= 4; i++) {
var str = "c" + i;
if (document.getElementById(str).checked == true) {
count++;
}
}
alert(count);
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<input type="checkbox" id="c1" value="1">fierst checkbox<br/>
<input type="checkbox" id="c2" value="2">second checkbox<br/>
<input type="checkbox" id="c3" value="3">third checkbox<br/>
<input type="checkbox" id="c4" value="4">four checkbox<br/>
<input type="button" onclick="srinu()" value="click me" />
</div>
</form>
</body>
</html>
Inherits="Test" %>
<!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 runat="server">
<title></title>
<script type="text/javascript" >
function srinu() {
var i;
var count = 0;
for (i = 1; i <= 4; i++) {
var str = "c" + i;
if (document.getElementById(str).checked == true) {
count++;
}
}
alert(count);
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<input type="checkbox" id="c1" value="1">fierst checkbox<br/>
<input type="checkbox" id="c2" value="2">second checkbox<br/>
<input type="checkbox" id="c3" value="3">third checkbox<br/>
<input type="checkbox" id="c4" value="4">four checkbox<br/>
<input type="button" onclick="srinu()" value="click me" />
</div>
</form>
</body>
</html>
No comments:
Post a Comment