´«ÖDz¥¿ÍAjaxÓëJavascript»ù´¡ÖªÊ¶×ܽáÉÏ
=================Ajax & Javascript====================
[½²Ê¦]Ù¡¸Õ
[½éÉÜ]½²¿Î²»´í£¬È˳¤µÄÒ²»¹²»´í£¬
[½²¿ÎÄÚÈÝ]Ö÷Òª½²struts1¡¢javascript¡¢ajax¡¢hibernate¡¢±àÂë¼ÓÇ¿Ö®ÏîĿʵս¡¢UML
¡¾JavaScript¡¿
====Ãû´Ê½âÊÍ====
a.DOM½éÉÜ£ºDocument Object Model(Îı¾¶ÔÏóÄ£ÐÍ)
D£ºÎĵµ – html Îĵµ »ò xml Îĵµ
O£º¶ÔÏó – document ¶ÔÏóµÄÊôÐԺͷ½·¨
M£ºÄ£ÐÍ
DOM ÊÇÕë¶Ôxml(html)µÄ»ùÓÚÊ÷µÄAPI¡£
DOMÊ÷:½Úµã£¨node£©µÄ²ã´Î¡£
DOM °ÑÒ»¸öÎĵµ±íʾΪһ¿Ã¼ÒÆ×Ê÷£¨¸¸£¬×Ó£¬Ðֵܣ©
DOM¶¨ÒåÁËNodeµÄ½Ó¿ÚÒÔ¼°Ðí¶àÖÖ½ÚµãÀàÐÍÀ´±íʾXML½ÚµãµÄ¶à¸ö·½Ãæ
b.½Úµã½éÉÜ(Node)£ºÀ´Ô´ÓÚÍøÂçÀíÂÛ£¬´ú±íÍøÂçÖеÄÒ»¸öÁ¬½Óµã¡£ÍøÂçÊÇÓɽڵ㹹³ÉµÄ¼¯ºÏ
c.½Úµã·ÖΪÈýÖÖÀàÐÍ£ºÔªËؽڵ㡢ÊôÐԽڵ㡢Îı¾½Úµã
d.Node½ÚµãÊǽӿڣ¬Api¶¨ÒåÁ˺ܶàÊôÐԺͷ½·¨¡£
e.²éÕҽڵ㣺ֻÓд´½¨Á˽ڵ㣬²Å¿ÉÒÔʹÓÃapiµÄÊôÐԺͷ½·¨
.getElementById("");
//ͨ¹ýidÊôÐÔÖµ²éÕÒ[ÔªËؽڵã]¶ÔÏó£¬Ã»Óзµ»Ønull
//¸Ã·½·¨Ö»ÄÜÓÃÓÚ document ¶ÔÏó
.getElementsByTagName("");
//ͨ¹ý±êÇ©Ãû·µ»Ø[ÔªËؽڵã]¼¯ºÏ£¬Ã»Óзµ»Ønull
//¸Ã·½·¨²»Ö»ÊÇÓÃÓÚ document ¶ÔÏ󣬻¹¿ÉÒÔʹÓÃÓÚ±ðµÄ[ÔªËؽڵã]¶ÔÏó
.getElementsByName("");
//ͨ¹ý±êÇ©µÄnameÊôÐÔÖµ²éÕÒ[ÔªËؽڵã]¶ÔÏó£¬Ã»Óзµ»Ønull
//¸Ã·½·¨²»Ö»ÊÇÓÃÓÚ document ¶ÔÏ󣬻¹¿ÉÒÔʹÓÃÓÚ±ðµÄ[ÔªËؽڵã]¶ÔÏó
.getAttributeNode("");
//ͨ¹ýÊôÐÔÃû³ÆµÃµ½ÊôÐԽڵ㣬һ°ã¶¼ÔÚijԪËؽڵãÀïÈ¥ÕÒ
f.½Úµã¶ÔÏóµÄÏà¹ØµÄÊôÐÔ½éÉÜ£ºÍ¨¹ý²éÕÒµ½µÄ½Úµã¶ÔÏóµ÷ÓÃ
.nodeName;//Ö»¶ÁÊôÐÔ
//µÃµ½½ÚµãµÄÃû³Æ
//ÔªËؽڵ㷵»ØµÄÊÇÔªËصÄÃû³Æ
//ÊôÐԽڵ㷵»ØµÄÊÇÔªËصÄ
//Îı¾½Úµã·µ»ØµÄÊÇ#text×Ö·û´®
.nodeType;//Ö»¶ÁÊôÐÔ
//µÃµ½½ÚµãµÄÀàÐÍ
//Node.ELEMENT_NODE (1) -- ÔªËؽڵã
//Node.ATTRIBUTE_NODE (2) -- ÊôÐÔ½Úµã
//Node.TEXT_NODE (3) -- Îı¾½Úµã
.nodeValue;//¶Á/дÊôÐÔ
//µÃµ½½ÚµãµÄÖµ
//ÔªËؽڵ㷵»Ønull
//ÊôÐԽڵ㷵»ØÖµÊÇÕâ¸öÊôÐÔµÄÖµ
//Îı¾½Úµã·µ»Ø¸ÃÎı¾
//¿ÉÒÔΪÎı¾½ÚµãµÄ nodeValue ÊôÐÔÉèÖÃÒ»¸öÖµ¡£
g.½Úµã¶ÔÏóµÄÏà¹ØµÄ·½·¨½éÉÜ£ºÍ¨¹ý²éÕÒµ½µÄ½Úµã¶ÔÏóµ÷ÓÃ
.getAttribute("");
//·µ»ØÒ»¸ö¸ø¶¨ÔªËصÄÒ»¸ö¸ø¶¨ÊôÐÔ½Úµãµ
Ïà¹ØÎĵµ£º
×ֺţº´ó ÖРС
·½·¨Ò»£º×µÄ£¬×îÈÝÒ×Àí½âµÄ£¬ÇÒ¿ÉÒÔËæÒâÉèÖÃÒªÅųýµÄ×Ö·û
<script language="javascript">
function isChinese1(str){
var badChar ="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
badChar += "abcdefghijklmnopqrstuvwxyz";
badChar += "0123456789";
badChar += " "+"¡¡";//°ë½ÇÓëÈ«½Ç¿Õ¸ñ
badChar ......
shift£ºÉ¾³ýÔÊý×éµÚÒ»Ï²¢·µ»Øɾ³ýÔªËصÄÖµ£»Èç¹ûÊý×éΪ¿ÕÔò·µ»Øundefined
var a = [1,2,3,4,5];
var b = a.shift(); //a£º[2,3,4,5] b£º1
unshift£º½«²ÎÊýÌí¼Óµ½ÔÊý×鿪ͷ£¬²¢·µ»ØÊý×éµÄ³¤¶È
var a = [1,2,3,4,5];
var b = a.unshift(-2,-1); //a£º[-2,-1,1,2,3,4,5] b£º7
×¢£ºÔÚIE6.0ϲ ......
Ô´´ÓÚ2007Äê12ÔÂ16ÈÕ£¬2009Äê10ÔÂ15ÈÕǨÒÆÖÁ´Ë¡£
JavaScriptͨ¹ýÄÚÖõÄsetTimeoutº¯ÊýÀ´Íê³ÉÒ³ÃæÄڵĶ¨Ê±¼ì²é£¬Ò²ÊǺܾÃÒÔǰдµÄ¶«Î÷ÁË¡£
Ö®ËùÒÔÏëÆðËüÀ´£¬ÊÇÒòΪÔÚºÍÏîÄ¿×éÆäËû³ÉԱ˵¸ÃÊÂÇéµÄʱºò£¬±ðÈ˾¹È»³°Ð¦ÎÒ˵ÊÇÉϸöÊÀ¼ÍµÄ´úÂ룬ÏÖÔÚ¶¼ÓÃWEB2.0ÁË¡£
<script language="JavaScript" type="text ......
replace()×î¼òµ¥µÄËãÊÇÄÜÁ¦¾ÍÊǼòµ¥µÄ×Ö·ûÌæ»»¡£
ʾÀý´úÂëÈçÏ£º
<script language="javascript">
var strM = "javascript is a good script language";
//ÔÚ´ËÎÒÏ뽫×ÖĸaÌæ»»³É×ÖĸA
alert(strM.replace("a","A"));
</script>
ËüÖ»Ìæ»»ÁËÊ××Öĸ¡£µ«Èç ......