why this simple javascript doesnt work on friefox and chrome?
Posted
by
user1647406
on Stack Overflow
See other posts from Stack Overflow
or by user1647406
Published on 2012-09-04T21:33:48Z
Indexed on
2012/09/04
21:37 UTC
Read the original article
Hit count: 171
why this simple code i have written wont work on fire fon and chrome but it works carefully on IE ? whats wrong whit this javascript code ? i just want to find a way too get selected checkbox text ( or label) and use it by $_post on another page . sorry for my bad english .
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<script type="text/javascript" language="javascript">
function ReadCheckbox()
{
var temp = '';
var radio;
var popupTag ;
for (var i=1 ; i<5 ; i++) {
radio = document.getElementById('chk'+i);
if(radio.checked == true){temp += radio.value}
}
document.getElementById('aaaa').value = temp;
}
</script>
</head>
<body>
<label>What is your Site Address ?</label><br/>
<label>NetNic.ir</label><input id="chk1" type="checkbox" value="NetNic.ir" />
<label>SarirWeb.Com</label><input id="chk2" type="checkbox" value="SarirWeb.Com"/>
<label>LearnCD.ir</label><input id="chk3" type="checkbox" value="LearnCD.ir"/>
<label>AnimLand.ir</label><input id="chk4" type="checkbox" value="AnimLand.ir"/>
<br />
<br/>
<textarea rows="2" name="aaaa" cols="20"></textarea>
<input type="button" onclick="ReadCheckbox()" value="???" style="height:32px; width:83px;"/>
© Stack Overflow or respective owner