L
led
I have this function that changes textbox when checkbox is checked. But
can´t unchecked again.
this is the code:
<input type="checkbox" name="C1" value="1" onclick=altera_txt("C1","prec1")
<script type="text/javascript">
function altera_txt(ck,txt)
{
if (document.forms["fp1"].elements[ck].checked=false)
{
document.forms["fp1"].elements[txt].disabled=true
document.forms["fp1"].elements[txt].value=""
}
else
{
document.forms["fp1"].elements[txt].disabled=false
document.forms["fp1"].elements[txt].focus()
document.forms["fp1"].elements[txt].value="Preço"
}
}
</script>
can´t unchecked again.
this is the code:
<input type="checkbox" name="C1" value="1" onclick=altera_txt("C1","prec1")
<script type="text/javascript">
function altera_txt(ck,txt)
{
if (document.forms["fp1"].elements[ck].checked=false)
{
document.forms["fp1"].elements[txt].disabled=true
document.forms["fp1"].elements[txt].value=""
}
else
{
document.forms["fp1"].elements[txt].disabled=false
document.forms["fp1"].elements[txt].focus()
document.forms["fp1"].elements[txt].value="Preço"
}
}
</script>