Hi guys,
Can someone please explain why the code below works in IE6 but not Firefox 1.5? I am new to Javascripting, and can’t work it out myself.
The script is supposed to print the name of the selected player in the DIV that is below.
I have the NoScript extension running in Firefox but It’s set to allow javascript from my dev server.
Cheers,
Nap
[CODE]<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01//EN” “http://www.w3.org/TR/html4/strict.dtd”>
<html lang=”en”>
<head><title>Untitled</title>
<meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1″>
<meta http-equiv=”Content-Script-Type” content=”text/javascript”>
<meta http-equiv=”Content-Style-Type” content=”text/css”>
<script type=”text/javascript”>
<!–
function getUserData() {
var x=document.getElementById(“playername”)
var y=document.getElementById(“mytest”)
y.innerHTML= ‘<b>’ + x.options[x.selectedIndex].text + ‘</b>’
}
//–>
</script>
</head>
<body>
<table border=”0″ cellpadding=”0″>
<tr>
<td><p class=”text”>Name:</p></td>
<form><td><select id=”playername” size=”1″ onchange=”getUserData()” name=”editname” style=”background-color: white; border: 1 solid black” class=”text”>
<option>ABC</option>
<option>DEF</option>
<option>GHI</option>
</select></td></form>
</tr>
<tr>
<td><div id=”mytest”>Goodbye</div></td>
</tr>
</table>
</body>
</html>