change html label on the fly

M

Matt

I want to change the label on the fly (when the user click the
checkbox), but my attempt
InputForm.lataLbl.value = "LATA * "; didn't work. Here's my code, any
ideas?
thanks !!!


<html>
<script type="text/javascript">
function ig_onchange()
{ if (InputForm.ig.checked == true)
{ InputForm.btn.value = "Populate";
InputForm.lataLbl.value = "LATA * "; //DOES NOT WORK!!!
}
else
{
InputForm.btn.value = "Validate";
}
}
</script>
<body>
<form name="InputForm">
<P><input type="checkbox" name="ig" onclick="ig_onchange()">
<P><label for="lataLbl">LATA</label>
<P><input type="button" name="btn" value="Validate">
</form>
</body>
</html>
 
T

Toby A Inkster

<html>
<script type="text/javascript">
function ig_onchange()
{
if (document.getElementById('ig').value == true)
{
document.getElementById('btn').value = "Populate";
document.getElementById('mylabel').innerHTML = "LATA *";
}

else
{
document.getElementById('btn').value = "Validate";
}
}
</script>
<body>
<form>
<P><input type="checkbox" name="ig" id="ig" onclick="ig_onchange()">
<P><label for="lataLbl" id="mylabel">LATA</label>
<P><input type="button" name="btn" id="btn" value="Validate">
</form>
</body>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top