JavaScript¶¯Ì¬Ìí¼Ó|°ó¶¨Ê¼þ
1£¬²»´ø²ÎÊýµÄʼþ£º
Á½ÖÖ·½Ê½£ºÖ±½Ó¸ø¶ÔÏóÌí¼Óʼþ,½ÚµãÌí¼Óʼþ
ÀýÈç¸øÒ»¸öidΪtab1µÄÌí¼Óonclickʼþ
µÚÒ»ÖÖÇé¿ö£º
var
t
=
document.getElementById(
"
NewTitle
"
);
t.onclick
=
function
showmsg(){
alert(
'
Hello!World
'
);
}
~
µÚ¶þÖÖÇé¿ö ÕâÖÖÇé¿ö¸ü¼Ó¶¯Ì¬£¬¸üΪʵÓ㬶øÇÒ»¹ÄÜÌí¼Ó¶à¸öº¯Êý(Ìí¼ÓµÄʼþµÄ˳Ðò¼´Ö´ÐÐ˳Ðò)£¬ºÇºÇ
var
tb
=
document.getElementById(
"
NewTitle
"
);
if
(window.addEventListener){
//
Mozilla, Netscape, Firefox
td_value.addEventListener(
'
click
'
, alert(
'
cc
'
),
false
);
td_value.addEventListener(
'
click
'
, alert(
'
cc
'
),
false
);
}
else
{
//
IE
td_value.attachEvent(
'
onclick
'
,
function
(){alert(
'
changchang
'
);});
td_value.attachEvent(
'
onclick
'
,
function
(){alert(
'
changchang
'
);});
}
~
2£¬´ø²ÎÊýµÄʼþ£º
½â¾ö·½·¨£ºÄäÃûº¯Êý£º
element.onclick
=
function
() {
functionName(param);
};
ÕâÑù¾ÍÇÉÃîµÄͨ¹ýÄäÃû·½·¨ÊµÏÖÁË£¡
Ïà¹ØÎĵµ£º
ÈÕÖ¾ÔÎÄ£ºhttp://zzgziyu.blog.sohu.com/109589244.html
<script>
("<html
xmlns:v><style>v\\:*{behavior:url(#default#VML)}</style>")
var
ct1=new ct()
function ct(){
="green,yellow,red,blue,gray,purple".split(",")
&nb ......
JavaScriptÊÇÒ»ÖÖͨÓõġ¢»ùÓÚÔÐ͵ġ¢ÃæÏò¶ÔÏóµÄ½Å±¾ÓïÑÔ£¬¶ø½Å±¾ÓïÑÔ¾ÍÊÇÖ¸¿ÉÒÔºÍHtmlÓïÑÔ»ìºÏʹÓõÄÓïÑÔ
1.JavaScriptÓëJavaµÄÇø±ð
A. JavaScriptÊǽâÊÍÐ͵ÄÓïÑÔ£¬µ±³ÌÐòÖ´ÐеÄʱºò£¬ä¯ÀÀÆ÷Ò»±ß½âÊÍÒ»±ßÖ´ÐС£¶øJavaÊDZàÒëÐ͵ÄÓïÑÔ£¬±ØÐë¾¹ý±àÒë²ÅÄÜÖ´ÐÐ
B. ´úÂë ......
1.ÉùÃ÷Ò»¸öDateʱ¼ä¶ÔÏóµÄ·½Ê½ÓÐÒÔÏÂÈýÖÖ
Date()£º±íʾ¹¹ÔìÒ»¸öµ±Ç°ÏµÍ³Ê±¼ä¶ÔÏó
Date(int year,int month,int day)£º¹¹ÔìµÄʱ¼ä¶ÔÏóËùÖ¸ÏòµÄʱ¼äΪ Ä꣺1900+year;Ô£ºmonth+1;ÈÕ£ºday;ʱ,·Ö,Ã룺00
Date(int millsecond)£º¹¹ÔìµÄʱ¼ä¶ÔÏó ......
ʵÀýÈçÏ£ºjavascript.htmlÎļþ
<html>
<head>
<title>JavaScriptÑéÖ¤</title>
</head>
<script language='JavaScript'>
......
½ñÌìżȻ¿´µ½ÁËconstructorÕâ¸ö¶«¶«£¬²»Ã÷°×ÓÃ;¡£Õҵ㶫Î÷±¸Íü
typeofº¯ÊýµÄÓ÷¨¿ÉÄܲ»ÓÃÎÒ¶à˵£¬´ó¼Ò¶¼ÖªµÀÔõôÓ᣶øconstructorÊôÐÔ´ó¼Ò¿ÉÄܾÍİÉúµã¡£ÔÚ¡¶¾«Í¨JavaScript¡·Õâ±¾ÊéÖÐÓÐÌáµ½constructµÄÓ÷¨£¬µ«ÎÒÓÃ×Ô¼ºµÄ¼¸¸öä¯ÀÀÆ÷£¨IE7.0 / Firefox1.9 / Opera9.50£©²âÊԵĽá¹ûÈ´ºÍÊéÉÏ˵µÄ²»Ò»Ñù¡£µ«ÊÇÈÔÈ»ÊÇÓÐ°ì·¨Í ......