Remove the second and third line.
"language=" is deprecated.
MidiMagic
Nearly a Senior Poster
3,319 posts since Jan 2007
Reputation Points: 730
Solved Threads: 182
Will using a separate .js file help?
MidiMagic
Nearly a Senior Poster
3,319 posts since Jan 2007
Reputation Points: 730
Solved Threads: 182
1. Where are your var declarations?
2. This script can't be inside script tags, because it contains a < character.
HTML takes back control when it sees that character. You must create a separate .js file.
3. Do you know which variables are3 global, and which are local. If you don't declare a variable as being global or local (as defined by where its var statement is) the browser has to guess.
MidiMagic
Nearly a Senior Poster
3,319 posts since Jan 2007
Reputation Points: 730
Solved Threads: 182
> If you don't declare a variable as being global or local (as defined by where its var
> statement is) the browser has to guess.
Not entirely true. There are two types of variables in javascript -- global scoped variables and function scoped variables. There is no block scope in javascript.
The var declarations only make sense inside a function though it't not illegal to preprend the same when declaring global variables. The browser doesn't need to guess anything. Anything prepended with a 'var' inside a function is a local variable, all other variables are globals except in the case when you declare you own namespace i.e. object literals.
~s.o.s~
Failure as a human
11,938 posts since Jun 2006
Reputation Points: 3,281
Solved Threads: 733