javascript¿ØÖÆÒ³Ãæ±íµ¥Öظ´Ìá½»
// PageLoadʼþ
var onloadMethod = window.onload;
window.onload = window_Load;
function window_Load() {
var i;
var item;
// È«²¿Á¬½ÓµÄʼþ
for (i = 0; i < document.links.length; i ++) {
item = document.links[i]
Object.Aspect.around(item, "onclick", checkLoading);
}
// È«²¿°´Å¥µÄʼþ
for (i = 0; i < document.forms[0].elements.length; i ++) {
item = document.forms[0].elements[i]
if (item.type == "button" ||
item.type == "submit" ||
item.type == "reset") {
Object.Aspect.around(item, "onclick", checkLoading);
}
}
if (onloadMethod != null && typeof (onloadMethod) == "function") {
// Ö´ÐÐPageµÄonloadʼþ
return onloadMethod();
} else {
return true;
}
}
// ·ÀÖ¹ÖØ¸´Ìá½»
var checkLoading = function(invocation) {
if (isDocumentLoading()) {
//alert("now loading…");
return false;
}
return invocation.proceed();
}
// µ±Ç°Ò³ÃæÌύ״̬ÅжÏ
function isDocumentLoading() {
return (document.readyState != null &&
document.readyState != "complete" &&
document.readyState != "interactive");
}
// Aspect ÓÃ
Object.Aspect = {
_around: function(target, methodName, aspect) {
var method = target[methodName];
target[methodName] = function() {
var invocation = {
"target" : this,
"method" : method,
"methodName" : methodName,
"arguments" : arguments,
"proceed" : function() {
if (!method) {
return true;
}
return method.apply(target, this.arguments);
}
};
return aspect.apply(null, [invocation]);
};
},
around: function(target, methodName, aspect) {
this._around(target, methodName, aspect);
}
}
Ïà¹ØÎĵµ£º
ÐèÇó£º
AÓòÓÐÒ³Ãæa.html£¬ÆäÖÐÓÐiframe°üº¬BÓòµÄÒ³Ãæb.html£¬ÏÖÔÚҪͨ¹ýa.htmlÉϵÄÒ»¸ö°´Å¥£¬À´°Ña.htmlÒ³ÃæÉÏÒ»¸öÎı¾¿òµÄÖµ´«µÝµ½b.htmlÒ³ÃæµÄÎı¾¿ò¡£
×¢£ºÕâÀïb.htmlÊÇhtmlÍøÒ³£¬²»ÄܽÓÊÕÆäËûÍøÕ¾post¹ýÀ´µÄÖµ£¬ËùÒÔ²»ÄÜÓÃÖ±½ÓpostµÄ·½·¨À´´«Öµ£¬µ«ÊÇ£¬Èç¹û½ÓÊÕÒ³ÃæÊÇb.aspx»òÕßb.asp ÄØ£¬ÄDz»ÊÇ¿ÉÒÔÖ±½ÓpostÁËô£¿´ð ......
<html>
<head>
<mce:script type="text/javascript"><!--
function aaa()
{
alert("oh no");
window.location="http://community.csdn.net/";
}
// --></mce:script>
</head>
<body onload = aaa();>
< ......
JavascriptµÄEvent¶ÔÏóÓÃÀ´ÃèÊöJavascriptµÄʼþ£¬ËüÖ÷Òª×÷ÓÃÓÚIE4ºÍNN4ÒÔºóµÄ¸÷¸öä¯ÀÀÆ÷°æ±¾ÖС£
Event´ú±íʼþ״̬£¬Èçʼþ·¢ÉúµÄÔªËØ£¬¼üÅÌ״̬£¬Êó±êλÖúÍÊó±ê°´Å¥×´Ì¬¡£Ò»µ©Ê¼þ·¢Éú,±ã»áÉú³ÉEvent¶ÔÏó£¬Èçµ¥»÷Ò»¸ö°´Å¥£¬ä¯ÀÀÆ÷µÄÄÚ´æÖоͲúÉúÏàÓ¦µÄ event¶ÔÏó¡£
IE¶ÔʼþµÄÒýÓÃ
ÔÚIE4ÒÔÉϰ汾ÖУ¬event¶ÔÏó×÷Î ......
javascriptÀïÃæÃ»ÓÐÏֳɵÄ×Ö·û´®×ª³ÉÈÕÆÚºÍʱ¼äÀàÐ͵ĺ¯Êý£¬Ö»ÄÜÀûÓÃnew Date(y,m,d,h,i,s,ms)»òÕ߯äËüÏàËÆµÄº¯Êý½øÐÐת»¯
ÒÔÏÂÊÇÒ»¸öʾÀý
alert(strToDate('2009/1/5 16:40'));
//×Ö·û´®×ªÈÕÆÚÀàÐÍ
function strToDate(str) {
var re=/^(\d{4})\/(\d{1,2})\/(\d{1,2}) (\d{1,2}):(\d{1,2})$/g
if(re.tes ......
±¾ÎÄÒë×Ô£ºhttp://www.codeproject.com/KB/scripting/jsbeginner.aspx
ÔÎÄ£ºJavaScript For Beginners
ÊÊÒ˶ÔÏó£ºJavaScript³õѧÕß¡£
Ŀ¼£º
°üº¬ÓëÒýÈë(Embedding,including)
write ºÍ writeln
Îĵµ¶ÔÏó£¨document object£©
bgColor ºÍ fgColor
ÏûÏ¢¿ò£¨Message Box£©
±äÁ¿£¨Variables ......