|
Get a 25% off coupon to use on any of our website scripts! - Subscribe to our Newsletter now!
|
Expected Identifier, String or NumberPosted 2009-04-05 in News
Internet Explorer gives the JavaScript error “Expected indentifier, string or number” when it’s expecting another variable. Firefox and Safari don’t have such a problem, but it’s easy to fix the error in your JS code if you can find where it’s located. In order to fix the “Error: Expected identifier, string or number” message in IE you must remove the last comma from your object lists. For example (comma marked in blue): var myObject = {
myvar : 10,
init : function() {
// Init code
},
myFunction : function() {
// Function code
},
};
Remove the comma above and our code works fine in IE, Firefox and Safari: var myObject = {
myvar : 10,
init : function() {
// Init code
},
myFunction : function() {
// Function code
}
};
I found a basic solution to this posted here, but the tough part is finding out where the error is being generated if you’re running a lot of JavaScript code. Internet Explorer’s JS error message tells you the location of the error (You can click “Error on page” in the browser status bar to see the full error if not already presented).
The “Line: xx” and “Char: xx” values tell you exactly where the error is occurring, but it only tells you the line and character position in the JS file being executed. If you’re including multiple JavaScript files try removing all but one and then adding them back again until the error pops up. Then find the line in that file and hopefully your error will be right there!
|
SearchPopular Articles
SubscribeSubscribe via RSS Stay current with Scriptalicious news and subscribe in your favorite RSS reader. Subscribe via EmailGet the latest Scriptalicious news delivered to your inbox. Tag Cloudseo guides seo scripts scriptalicious seo tools forums PageRank SEO services content development apache htaccess mod_rewrite scripts webmaster google yahoo JavaScript XMLHttpRequest php contest software website list facebook ebook pagerank bing backlink rankings tool turnkey checker alexa themes marketing tinymce wysiwyg browser rank script tools legal trademark infringement mysql social web social networking advertising google plus plus one backlinks |
77 powerful SEO scripts for under $100. |
Real-time Backlink Rank Checker script. |