No language, JavaScript actually supports Chinese (Unicode) programming! _javascript Tips

Source: Internet
Author: User
It has long been discovered that for an HTML element, the ID can be Chinese, and the getElementById method can be used to correctly access the DOM
Little brother is ignorant, today I know IE actually support JavaScript Chinese programming
<input Type=button value= "Gorush" id= "Asun" >
<script>
function Asun:: OnClick () {alert (this.value)}//c++ style
function Asun:: onmouseout () {this.style.background= "green"}
function Asun. onmouseover () {this.style.background= "red"}
Is the function Chinese also OK? () {//Chinese letter of function name
var of course = "What's wrong with that?" Chinese variable name
Alert (sure line);
}
Chinese is OK? ()
</script>
To a segment of Unicode:
function \u3456 () {
var \u1234= "Gorush"
Alert (\u1234)
}
\u3456 ()
The above code is tested under ie6.0 and can be run correctly.
Firefox also supports Chinese (Unicode) functions and variable names, ie other versions have not been tested.
In fact, this feature also has no practical value, to play can also ...
BTW:
Firefox does not support C + +-style function names
function Window::onload () {...} This IE support FF does not support
function window.onload () {...} This IE support FF does not support
Window.onload=function () {...} Both the IE and FF support
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.