Wolfie7873
Technical User
Forgive me that this isn't strictly AJAX, but I need to get the script working before I can starting using the request object to do the dirty work.
I'm trying to enable a text input if a checkbox is checked. The default state on page load should be disabled.
Here is my code
When I render the page, the textbox is enabled and changing the state of the checkbox has no effect.
What gives?
I'm trying to enable a text input if a checkbox is checked. The default state on page load should be disabled.
Here is my code
Code:
<script type='text/javascript'>
document.getElementById('count_box').disabled = true;
function chgCountBox(str)
{
if (str=='true')
{
document.getElementById("count_box").disabled=false;
document.getElementById("countprompt").innerHTML="How Many?";
}
if (str=='false')
{
document.getElementById("count_box").disabled=true;
document.getElementById("countprompt").innerHTML="";
}
}
</script>
</head>
<body>
<form>
<input type="checkbox" id="cbox1" onchange="chgCountBox(this.checked)">
Create Correlation(s):
<span id="countprompt"></span>
<input type='text' id='count_box'>
</form>
When I render the page, the textbox is enabled and changing the state of the checkbox has no effect.
What gives?