Did web browsers support any form of VM bytecode for client side开发者_运维技巧 languages? And how did javascript become the exclusive language for the web?
Edit: I should have clarified. Is JavaScript the only language for operating on the HTML DOM?
Check out CoffeeScript. It is compiled to JavaScript so can be used anywhere JavaScript can be used.
JavaScript being the target of compilation is now the VM of the Web. 15 years ago it was Java that was to be the language of the Web, but it failed for various reasons.
If you're interested why, I recommend watching the talks by Douglas Crockford.
The main other one is VBScript, which is supported by IE. There are also several languages that compile to JavaScript, including Pyjamas (Python), GWT (Java), and CoffeeScript
Highly recommend sticking with javascript. Its very easy to use once you get the hang of it and it gives you a foundation for other things like actionscript which is used with Flash and other Adobe technologies.
Yes.
Three others are currently used fairly frequently: Flash, Java, and Silverlight.
With the exception of Flash for Google Chrome and VBScript for Internet Explorer 7 and below, web browsers haven't supported any other client side language out of the box.
To answer your question about how JavaScript become so widely used, please see this question and its answers:
https://softwareengineering.stackexchange.com/questions/28947/how-did-javascript-become-popular
Edit
Java, Flash, and Silverlight cannot interact with the DOM directly, but they can manipulate the DOM interacting with JavaScript. If your question is limited to languages that can directly interact with the DOM, you're left with only JavaScript and the now-defunct VBScript.
精彩评论