OK, I'm clueless with Javascript, but I'm trying to understand. I need to enable the user to select from three different checkboxes. If a checkbox is checked, then a input text box should appear, where the user can input their information. I'd like the value of those boxes to then be passed through a SQL statement into my application.
The code below is saved as a .hta file and it will run with three check boxes. Each time one of the check boxes is clicked, the corresponding text box appears.
However, if you uncheck any of the check boxes, the text box still is there...how can I get the text boxes to disappear if the check box is unchecked?
Also, when I reload the file, each check box is left as it was, rather then being unchecked at run-time.
The Answer function does nothing right now, but I'd like for it to pass the data from the text boxes via SQL. I've got a VBS script to pass the SQL statement, but I'm not sure how well that plays with Javascript...
The code below is saved as a .hta file and it will run with three check boxes. Each time one of the check boxes is clicked, the corresponding text box appears.
However, if you uncheck any of the check boxes, the text box still is there...how can I get the text boxes to disappear if the check box is unchecked?
Also, when I reload the file, each check box is left as it was, rather then being unchecked at run-time.
The Answer function does nothing right now, but I'd like for it to pass the data from the text boxes via SQL. I've got a VBS script to pass the SQL statement, but I'm not sure how well that plays with Javascript...
Code:
<HTML>
<HEAD>
<TITLE>Select Item to Change</TITLE>
<script language="javascript">
<!--
function showName() {
var c = document.forms['the_form'].elements['Name_chkbox'];
var dS = document.getElementById('Name');
var dH = document.getElementById('');
dS.style.display = 'inline';
dH.style.display = 'none';
c.onclick = hide;
}
function showPhone() {
var c = document.forms['the_form'].elements['Phone_chkbox'];
var dS = document.getElementById('Phone');
var dH = document.getElementById('');
dS.style.display = 'inline';
dH.style.display = 'none';
c.onclick = hide;
}
function showAddress() {
var c = document.forms['the_form'].elements['Address_chkbox'];
var dS = document.getElementById('Address');
var dH = document.getElementById('');
dS.style.display = 'inline';
dH.style.display = 'none';
c.onclick = hide;
}
function hide() {
var c = document.forms['the_form'].elements['Name_chkbox'];
var dS = document.getElementById('');
dS.style.display = 'none';
c.onclick = show;
}
-->
</script>
</HEAD>
<BODY scroll="no">
<P>
<form name="the_form">
Select Item to Change:
<P>
<input type="checkbox" name="Name_chkbox" onclick="showName();">Name
<input type="checkbox" name="Phone_chkbox" onclick="showPhone();">Phone
<input type="checkbox" name="Address_chkbox" onclick="showAddress();">Address
<P>
<div id="Name" style="display: none;">
Enter new name: <input type="text" name="Name_text">
</div>
<BR>
<div id="Phone" style="display: none;">
Enter new phone #: <input type="text" name="Phone_text">
</div>
<BR>
<div id="Address" style="display: none;">
Enter new address: <input type="text" name="Address_text">
</div>
<BR>
</FORM>
<P>
<INPUT TYPE="submit" onClick="Answer()">
</BODY>
</HTML>