Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Newb question about forms and functions 1

Status
Not open for further replies.

ballhogjoni

Programmer
Mar 3, 2008
1
US
Please help me with this code. I am gettign a object expected on line 32 error. Line 32 is <select name="COUNTRY" id="COUNTRY" onChange="checkCounty()">

<script language="javascript">
function checkCountry() {
var country = this.form[0].COUNTRY.value;
if (country == "United States") {
var stateProvidence = "<select name=\"STATEORPROVINCE\"></select><input type=\"hidden\" name=\"r_STATEORPROVINCE\" value=\"Please enter the state\">";
} else if (1+1==5) {

} else {
var stateProvidence = "<font color=\"#FF0000\">State is not needed for the United Kingdom</font></p>";
}
}
</script>
</head>
<body>
<form action="cccccc.php" name="form1" method="post">
<table width="350" border="0" cellpadding="2" cellspacing="2">
<tr>
<td align="right" width="157"><b><label for="COUNTRY">Country</label></b></td>
<td>
<select name="COUNTRY" id="COUNTRY" onChange="checkCounty()">
<option value="">Select One</option>
<option value="United States" selected="selected">United States</option>
<option value="United Kingdom">United Kingdom</option>
<option value="Australia">Australia</option>
<option value="Canada">Canada</option>
<option value="Ireland">Ireland</option>
<option value="New Zealand">New Zealand</option>
<option value="South Africa">South Africa</option>
<option value="Puerto Rico">Puerto Rico</option>
</select>
<input type="hidden" name="r_COUNTRY" value="Please enter the country"> </td>
</tr>
</table>
 
Check spelling : "checkCounty" in the onclick event of your select is not the same that the name of the function you want to call : "checkCountry"


Water is not bad as long as it remains outside human body ;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top