spider_designs Posted March 21, 2006 Share Posted March 21, 2006 <html><head><script type="text/javascript">const nochange='This should always be the same';function writeIt () { document.writeln (nochange);}</script></head><body><input type="button" onclick="writeIt()" value="Write"></body></html> how come any time I add a const statement to a script I get an error at the line of the const statement? also functions called from an event eg onload="test()" return an object expected error ( even if they are not related to the const statement).Core javascript guide says:You can create a read-only, named constant with the const keyword. The syntax of a constant identifier is the same as for a variable identifier: it must start with a letter or underscore and can contain alphabetic, numeric, or underscore characters. const prefix = '212'; spider Link to comment Share on other sites More sharing options...
scott100 Posted March 21, 2006 Share Posted March 21, 2006 Hello fellow highlander const is a Mozilla-specific extension, it is not supported by IE or Opera. If you view your code in firefox it works ok. Link to comment Share on other sites More sharing options...
spider_designs Posted March 21, 2006 Author Share Posted March 21, 2006 hmmm intresting ..well maybe just to me ...thanks Scott Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now