发布于 2016-09-17 08:08:44 | 129 次阅读 | 评论: 0 | 来源: 网友投递
这里有新鲜出炉的Javascript教程,程序狗速度看过来!
JavaScript客户端脚本语言
Javascript 是一种由Netscape的LiveScript发展而来的原型化继承的基于对象的动态类型的区分大小写的客户端脚本语言,主要目的是为了解决服务器端语言,比如Perl,遗留的速度问题,为客户提供更流畅的浏览效果。
if (W3C/Netscape) {
use W3C/Netscape model for access and property names
}
else if (Explorer) {
use Microsoft model for access and property names
}
function doSomething(e) {
// e gives access to the event
}
element.onclick = doSomething;
function doSomething() {
// window.event gives access to the event
}
element.onclick = function () {alert('Event type is ' + window.event.type)}
element.onclick = doSomething;
function doSomething(e) {
if (!e) var e = window.event;
// e gives access to the event in all browsers
}
<pre onclick="doSomething(event)">
function doSomething(e) {
alert(e.type);
}