Forum Moderators: open
<SCRIPT type="text/javascript">
function newTest(myValue){
alert("Check");
document.getElementById("testDiv").innerHTML = myValue;
}
</SCRIPT>
<BODY>
<div id="testDiv">
</div>
<select name="test1" onChange="newTest(this.value)">
<option value="value1" >value1</option>
<option value="value2" >value2</option>
<option value="value3" >value3</option>
<option value="value4" >value4</option>
</select>
</BODY>
I would like to have the user select a value from the list box, then call the function and update the div tag. This works perfectly on windows, and it will work on a mac if I use the onBlur() or onFocus() events but the onChange() even will not call the function for some reason. It just does nothing.
Can anybody help tell me how to get this to work on a MAC? Thanks,
Aaron French
Web Developer
<body>
<form>
<SELECT name="sport" onChange="alert(this.value)">
<OPTION SELECTED>--Choose a Sport-- </OPTION>
<OPTION value="FBall 1">Football - 1</OPTION>
<OPTION value="BBall 1">Basketball - 1</OPTION>
<OPTION value="Hockey 1">Hockey - 1</OPTION>
</SELECT>
</form>
<SELECT name="sport" onChange="alert(this.value)">
<OPTION SELECTED>--Choose a Sport-- </OPTION>
<OPTION value="FBall 2">Football - 2</OPTION>
<OPTION value="BBall 2">Basketball - 2</OPTION>
<OPTION value="Hockey 2">Hockey - 2</OPTION>
</SELECT>
</body>
Does anybody know why the onClick() event will not work when the select is embedded within the form tags? Any help would be greatly appriated, this works on PC, just not on a MAC computer.
What I am wanting to do with this is have the user select an option from the box, this the next select box will appear using div tags and populated from a database. This will happen through four selections and then the enter button will appear to submit the form and selections. It works on PC, just not on MAC.
Thanks
Aaron
This is the most rediculous thing ever. Any other ideas? Does anybody have a MAC to copy that code into a blank HTML document and see if it is working for you? I'm open to ideas. Thanks
Aaron
Something not covered, I used this, note the doctype:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Home Page Sample</title>
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
</head>
<body>
<form>
<SELECT name="sport" onChange="alert(this.value)">
<OPTION value="" SELECTED>--Choose a Sport-- </OPTION>
<OPTION value="FBall 1">Football - 1</OPTION>
<OPTION value="BBall 1">Basketball - 1</OPTION>
<OPTION value="Hockey 1">Hockey - 1</OPTION>
</SELECT>
</form>
</body>
</html>
And while it's **probably** irrelevant, you might try using the value attribute for your selected:
<OPTION value="" SELECTED>--Choose a Sport-- </OPTION>
Probably means nothing, but doesn't hurt to have all your duckies in a row.
I always encounter huge problems with Mac browsers. I find myself developing a site, then sometimes having th tear the whole thing down and build it again to get it all to work on a Mac. So what you're experiencing is no surprise at all.