I’m trying to create a funnction which would check too ssee if a variable was set, and output certain html code if it was, and output soome other html code if it wasn’t
here’s my html code
[code=html]
<select name=”country” onChange=”checkCountry()”> ……..</select>
heres the javascript function
function checkCountry() {
var ctry = document.form1.country[document.form1.country.selectedIndex].value;
if (ctry == “USA”) {
document.write(<p><label>State</label><input type=text name=state></p>);
} else {
document.write(<p><label>Country</label><input type=text name=country></p>);
}
}
Thanks!
(is there another easier way to do this?)