JavaScript¸÷ÖÖÓ÷¨
1.document.write(""); Êä³öÓï¾ä
2.JSÖеÄ×¢ÊÍΪ//
3.´«Í³µÄHTMLÎĵµË³ÐòÊÇ:document->html->(head,body)
4.Ò»¸öä¯ÀÀÆ÷´°¿ÚÖеÄDOM˳ÐòÊÇ:window->(navigator,screen,history,location,document)
5.µÃµ½±íµ¥ÖÐÔªËصÄÃû³ÆºÍÖµ:document.getElementById("±íµ¥ÖÐÔªËصÄIDºÅ").name(»òvalue)
6.Ò»¸öСдת´óдµÄJS: document.getElementById("output").value = document.getElementById("input").value.toUpperCase();
7.JSÖеÄÖµÀàÐÍ:String,Number,Boolean,Null,Object,Function
8.JSÖеÄ×Ö·ûÐÍת»»³ÉÊýÖµÐÍ:parseInt(),parseFloat()
9.JSÖеÄÊý×Öת»»³É×Ö·ûÐÍ:(""+±äÁ¿)
10.JSÖеÄÈ¡×Ö·û´®³¤¶ÈÊÇ:(length)
11.JSÖеÄ×Ö·ûÓë×Ö·ûÏàÁ¬½ÓʹÓÃ+ºÅ.
12.JSÖеıȽϲÙ×÷·ûÓÐ:==µÈÓÚ,!=²»µÈÓÚ,>,>=, <. <=
13.JSÖÐÉùÃ÷±äÁ¿Ê¹ÓÃ:varÀ´½øÐÐÉùÃ÷
14.JSÖеÄÅжÏÓï¾ä½á¹¹:if(condition){}else{}
15.JSÖеÄÑ»·½á¹¹:for([initial e xpression];[condition];[upadte e xpression]) {inside loop}
16.Ñ»·ÖÐÖ¹µÄÃüÁîÊÇ:break
17.JSÖеĺ¯Êý¶¨Òå:function functionName([parameter],...){statement[s]}
18.µ±ÎļþÖгöÏÖ¶à¸öform±íµ¥Ê±.¿ÉÒÔÓÃdocument.forms[0],document.forms[1]À´´úÌæ.
19.´°¿Ú:´ò¿ª´°¿Úwindow.open(), ¹Ø±ÕÒ»¸ö´°¿Ú:window.close(), ´°¿Ú±¾Éí:self
20.״̬À¸µÄÉèÖÃ:window.status="×Ö·û";
21.µ¯³öÌáʾÐÅÏ¢:window.alert("×Ö·û");
22.µ¯³öÈ·ÈÏ¿ò:window.confirm();
23.µ¯³öÊäÈëÌáʾ¿ò:window.prompt();
24.Ö¸¶¨µ±Ç°ÏÔʾÁ´½ÓµÄλÖÃ:window.location.href="/blog/URL"
25.È¡³ö´°ÌåÖеÄËùÓÐ±íµ¥µÄÊýÁ¿:document.forms.length
26.¹Ø±ÕÎĵµµÄÊä³öÁ÷:document.close();
27.×Ö·û´®×·¼ÓÁ¬½Ó·û:+=
28.´´½¨Ò»¸öÎĵµÔªËØ:document.createElement(),document.createTextNode()
29.µÃµ½ÔªËصķ½·¨:document.getElementById()
30.ÉèÖÃ±íµ¥ÖÐËùÓÐÎı¾Ð͵ijÉÔ±µÄֵΪ¿Õ:
var form = window.document.forms[0]
for (var i = 0; i <form.elements.length;i++){
if (form.elements.type == "text"){
form.elements.value = "";
}
}
31.¸´Ñ¡°´Å¥ÔÚJSÖÐÅжÏÊÇ·ñÑ¡ÖÐ:document.forms[0].checkThis.checked (checkedÊôÐÔ´ú±íΪÊÇ·ñÑ¡Öзµ»ØTRUE»òFALSE)
32.µ¥Ñ¡°´Å¥×é(µ¥Ñ¡°´Å¥µÄÃû³Æ±ØÐëÏàͬ):È¡µ¥Ñ¡°´Å¥×éµÄ³¤¶
Ïà¹ØÎĵµ£º
javascriptÄÚ´æ鶵ÄÎÊÌâÒ»Ö±ÒÔÀ´¶¼²»Êܵ½´ó¼ÒµÄÖØÊÓ£¬ÔÒòÊǶÔÓû§µÄÓ°ÏìûÓÐ̫ʵ¼ÊµÄ±íÏÖ£¬»òÐí½ü¼¸ÄêÄڴ淢չѸËÙ¡£½Å±¾ÄÚ´æÔÙй¶Ҳ²»»áÓÐÌ«´óÓ°Ïì¡£
µ±È»×÷Ϊǰ¶Ë¿ª·¢µÄͬѧÃÇ£¬¾Í²»ÄÜÓÐÕâÑùµÄ½ÄÐÒÐÄÀí¡£³öÏÖmemory leaksºÜ´ó³Ì¶ÈÉÏÊÇÒòΪ³ÌÐòµÄ²»³ÉÊìºÍ±àÂ벻̫¹æ·¶Ôì³ÉµÄ¡£²»¹ý£¬ÕâÀï¾Í²»ËµÈçºÎ³öÏÖÎÊÌâµÄ£¬¶ÔÎÊÌ ......
ʱ¼ä¶ÔÏó: Date()
ʹÓÃÇ°ÐèÒªÉùÃ÷/´´½¨¶ÔÏó, var currentTime = new Date();
³£Ó÷½·¨:
getYear(); getMonth(); getDate(); getDay(); getHours(); getMinutes
(); getSeconds(); getTime();
setYear(); setMonth(); setDate(); setHours(); setMinutes();
......
javaScript ½ØÈ¡×Ö·û´®
Á½ÖÖ·½·¨£º
String.substr(N1,N2) Õâ¸ö¾ÍÊÇÎÒÃdz£ÓõĴÓÖ¸¶¨µÄλÖÃ(N1)½ØÈ¡Ö¸¶¨³¤¶È(N2)µÄ×Ö·û´®;
String.substring(N1,N2) Õâ¸ö¾ÍÊÇÎÒÃdz£ÓõĴÓÖ¸¶¨µÄλÖÃ(N1)µ½Ö¸¶¨µÄλÖÃ(N2)µÄ×Ö·û´®;
ÀýÈç
¶ÔÓÚhttp://localhost:8008index.aspx
substr(22,5)=substring(22,27)
Result:index
´òÓ¡±¾Ò³
......
ÍøÒ³¿É¼ûÇøÓò¿í£º document.body.clientWidth
ÍøÒ³¿É¼ûÇøÓò¸ß£º document.body.clientHeight
ÍøÒ³¿É¼ûÇøÓò¿í£º document.body.offsetWidth (°üÀ¨±ßÏߵĿí)
ÍøÒ³¿É¼ûÇøÓò¸ß£º document.body.offsetHeight (°üÀ¨±ßÏߵĸß)
ÍøÒ³ÕýÎÄÈ«ÎÄ¿í£º document.body.scrollWidth
ÍøÒ³ÕýÎÄÈ«Îĸߣº document.body.scrollHeight
ÍøÒ ......
<html>
<head>
<title>test javaScript</title>
//cssÉèÖÃͼÏñµÄ͸Ã÷¶È
<mce:style><!--
img
{
filter:alpha(opacity=10)
}
--></mce:style><style mce_bogus="1">img
{
filter:alpha(opacity=10)
}</style>
<mce:script type="text/javasc ......