Hi, Experts,
I wrote a piece of html/javascript code, which does following:
1) if you select a country name other than USA, then you need to enter a state/province name;
2) if you select USA, then you need to pick a state name from a dropdown list.
Here is my code:
Bascially, the above code works OK, except one thing:
The POSITION of the State/Province row is NOT fixed on the screen. Please have a test run and you'll see what I mean.
Is there a way to fix its position? Thank you for your help.
I wrote a piece of html/javascript code, which does following:
1) if you select a country name other than USA, then you need to enter a state/province name;
2) if you select USA, then you need to pick a state name from a dropdown list.
Here is my code:
Code:
<HTML> <HEAD> <TITLE>Intelligent Forms</TITLE>
<SCRIPT>
function change(userInput) {
if(userInput.value == 'usa') {
StateDiv2.style.visibility='hidden';
StateDiv1.style.visibility='visible';
mainform.state1.focus();
}
else {
StateDiv1.style.visibility='hidden';
StateDiv2.style.visibility='visible';
mainform.state2.focus();
}
}
</SCRIPT>
</HEAD>
<BODY>
<FORM NAME="mainform">
Select a country
<select name="country" onclick="change(this);">
<option value="cv1">Country 1</option>
<option value="cv2">Country 2</option>
<option value="usa">USA</option>
<option value="cv4">Country 4</option>
</select>
<DIV ID="StateDiv1" style="visibility:hidden">
<LABEL FOR="state1">
State/Province:
<select name="statename">
<option value="sv1">Select a State</option>
<option value="sv2">MA</option>
<option value="sv3">NH</option>
<option value="sv4">NY</option>
</select>
</LABEL>
</DIV>
<DIV ID="StateDiv2" style="visibility:visible">
<LABEL FOR="state2">
State/Province: <input name="pn"/>
</LABEL>
</DIV>
<BR>
<INPUT TYPE="SUBMIT">
<INPUT TYPE="RESET">
</FORM>
</BODY> </HTML>
Bascially, the above code works OK, except one thing:
The POSITION of the State/Province row is NOT fixed on the screen. Please have a test run and you'll see what I mean.
Is there a way to fix its position? Thank you for your help.