newphpbees
11 Apr 2012, 11:37 PM
Hi..
I have checkbox and I need to get his value.
I create function for checkbox if checkbox is clicked it is true then the checkbox value is H else W.
function chk(){
if(document.getElementById('H').checked==true){
var H = document.getElementById('H'). value = H;
}
else if(document.getElementById('H').checked==false){
var H = document.getElementById('H'). value = W;
}
}
and I have function for save :
function ApproveLeaveOP(){
var H = document.getElementById('H').value;
document.sampleform.action="AddLeave.php?H="+H;
document.sampleform.submit();
}
<input type="checkbox" name="H" id="H" value="" onclick="chk()">
I don't know how can I add value to the checkbox if I click the value will be H if not the value is W.
I am new in using checkbox.
Thank you so much..
I have checkbox and I need to get his value.
I create function for checkbox if checkbox is clicked it is true then the checkbox value is H else W.
function chk(){
if(document.getElementById('H').checked==true){
var H = document.getElementById('H'). value = H;
}
else if(document.getElementById('H').checked==false){
var H = document.getElementById('H'). value = W;
}
}
and I have function for save :
function ApproveLeaveOP(){
var H = document.getElementById('H').value;
document.sampleform.action="AddLeave.php?H="+H;
document.sampleform.submit();
}
<input type="checkbox" name="H" id="H" value="" onclick="chk()">
I don't know how can I add value to the checkbox if I click the value will be H if not the value is W.
I am new in using checkbox.
Thank you so much..