Smart HTML Forms

admin

Administrator
Staff member
HTML Form Script

I need to write a script that will allow managers to be able to select diferent parts of a form via tick boxes and those relevent parts of the form will appear ie

A new user requires NT and Email but not novell ..... so they would tick NT and Email and the relevent parts of the form appear , but if they untickthe checkbox the NT part of the form would disappear .

I have written a demo script but it uses <DIV> and each part of the form jups down the page because I am using the <hidden> command could anyone point me in the correct direction

Demo
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE></TITLE>
<SCRIPT LANGUAGE=javascript>
<!--
function hideText(){
if(document.forms[0].checkbox1.checked){
document.getElementById("formitem").style.visibility="hidden"
}else{
document.getElementById("formitem").style.visibility="visible"

}
}

//-->
</SCRIPT>
<SCRIPT LANGUAGE=javascript>
<!--
function hideText2(){
if(document.forms[0].checkbox2.checked){
document.getElementById("formitem2").style.visibility="hidden"
}else{
document.getElementById("formitem2").style.visibility="visible"

}
}

//-->
</SCRIPT>
</div>
</HEAD>
<BODY>

<FORM action="" method=POST name=form >
NT 1<INPUT type="checkbox" name=checkbox1 onmousedown="javascript:hideText()"><p>
Email- 2<INPUT type="checkbox" name=checkbox2 onmousedown="javascript:hideText2()"><p>
<div id="formitem" style="visibility:hidden;Position:relative"><td><tr>Test 1<INPUT type="text" name=text1>
<div id="formitem2" style="visibility:hidden ;Position:relative"><blink>Test 2</blink><INPUT type="text" name=text2 >



</div>
</FORM>
</BODY>
</HTML>



Cheers
Andy
 
Back
Top