Forum Moderators: open
I have never used Java Script because for years, I thought that it may not work on some browsers and for those who are using PDA, palm etc.
My new developer suggests that a progress indicator function that I need can only be implemented if he uses Java Script.
Can you guys tell me if I should be concerned about this?
1. Is Java Script now supported by all the browsers?
2. Are there different versions of Java Script and should I use a particular one of them?
I many time see Java Script error in the status bar of my browser for other sites, and I don't want to see that on my web site.
Thanks in advance
sdani
Are there different versions of Java Script
Yes -ish. You could say that the term 'Javascript' is a specific/proprietary term that has ended up being used generically. Think:
Biro : ballpoint pen
Sellotape/Scotch Tape : sticky tape
Hoover : vacuum cleaner (UK anyway)
There are variously named versions of this 'Javascript' that are nominally centered on ECMA Script:
Javascript - Most browsers other than...
JScript - Internet Explorer
ActionScript - Flash
and should I use a particular one of them?
You have no choice in the matter at all.
Use this attribute in your script tags
[blue]type="text/javascript"[/blue] What language is actually being used depend entirely on the browser.
Most (practical) differences between implementations in browsers are actually differences in the browser object models, not the core scripting language (That said 'real' Javascript has some structural extras, like getter/setter properties, not available in JScript).
Trivia:
In Windows 2000/98 the "Web-style folders" feature uses HTML templates (.htt files). Even though they are an integral part of the Windows GUI, and thus will never run anything other than JScript, their script blocks carry the (depracated) language attribute declaring "Javascript". I wonder if anyone got fired?
I many time see Java Script error in the status bar of my browser for other sites, and I don't want to see that on my web site.
It is irritating, isn't it. Sun's Java website is currently throwing up "stack overflow" alerts. You'd think they'd know how to use a scripting language.
You can hide that nasty error triangle by including this small piece of code:
[blue]window.onerror = function(){return true;}[/blue] Your unforgiveable errors will no longer be visible by the punters.
Javascript should be used to enhance page functionality. You should try to avoid it for essentials because some users switch it off.
You can use the <noscript></noscript> tag to wrap html code that should only be applied if js is absent/disabled. However, you should be aware that whilst browsers are happy for <noscript> tags to appear in the <head> w3c validation will generate an error.
Kaled.