I just think this is useful for people having this problem:
I had this code:
<html>
<head>
<link rel="stylesheet" href="example.css" type="text/css"/>
<title>CSS TESTS</title>
<script language="text/javascript">
var move = 0;
</script>
</head>
<body>
<input type="text" id="shape" onchange="alert(move);"/>
</body>
</html>
But I couldn't get the alert to work. I would get the Uncaught ReferenceError: move is not defined.
It turns out that the language attribute on the script tag did not allow me to specify text/javascript but only javascript. The type attribute allows "text/javascript". That was all and I spent hours trying to find the bug in the javascript code... arg!
So, basically I changed the line that said
<script language="text/javascript">
to
<script type="text/javascript">
and it all worked.
Change <script language="text/javascript">
TO <script type="text/javascript">
Working Code --
<html>
<head>
<link rel="stylesheet" href="example.css" type="text/css"/>
<title>CSS TESTS</title>
<script type="text/javascript">
var move = 0;
</script>
</head>
<body>
<input type="text" id="shape" onchange="alert(move);"/>
</body>
</html>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With