'Clear checkbox and textarea onload javacript
I made a javascript code to clear checkbox and textarea when the page loads. The code works on Firefox but it does not on google chrome. Do have any idea how to change my code to be fonctional on both browsers ?
Call the the javascript function onload:
<body onload="eraseTest()">
in the page the javascript code:
<td><input type="checkbox" name="ampli" id="ampli" value="ampli" onchange="valueChanged()">Ampli?
<script type="text/javascript">
function valueChanged(){
if (document.getElementById('ampli').checked)
{document.getElementById("subnetmaskdiv").style.display = 'block';
}
else
document.getElementById("subnetmaskdiv").style.display = 'none';
document.getElementById("subnetmaskdiv2").style.display = 'none';
}
</script>
<script>
//Function to reset onload comment textarea and checkbox ampli+input fields of ampli
function eraseTest(){
document.getElementById("comment").value="";
document.getElementById("ampli").checked=false;
document.getElementById("geneName").value="";
document.getElementById("AmpliGene").value="";
}
</script>
<div id="subnetmaskdiv" style="display:none;">Gene:<input type="text" name="geneName" id="geneName"/>
<br/>Valeur Ampli:<input type="text" size="3" name="AmpliGene" id="AmpliGene"/></div></td></tr>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
