Wednesday, 18 September 2013

html5 validation error on simple javascript dropdown

html5 validation error on simple javascript dropdown

I have a simple javascript dropdown menu that I'm getting an HTML5
validation error. The error is "Bad value goto(this); for attribute
onchange on element select: identifier is a reserved word." Can anyone
help me out with what to change in the code:
<script>
<!--
function goto(choose){
var selected=choose.options[choose.selectedIndex].value;
if(selected != ""){
location.href=selected;
}
}
//-->
</script>
<strong><SELECT onChange="goto(this);"></strong>
<option value="">--Choose studio--</option>
<option value="[home]/studio-1/">Studio 1</option>
<option value="[home]/studio-2">Studio 2</option>
</SELECT>';

No comments:

Post a Comment