Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

javascript½âÎöXML

 Ê×ÏÈ´´½¨½âÎö¶ÔÏó£º
try
{
xmldoc=new ActiveXObject("Microsoft.XMLDOM");//IE
}catch(e)
{
try{
xmldoc=document.implementation.createDocument("","",null);//·ÇIE
}catch(e)
{
alert("ÎÞ·¨´´½¨¶ÔÏó£¡");
return;
}
}
xmldoc.async="false";
xmldoc.load("we.xml");
//°Ñ×Ö·û´´txtÔØÈë½âÎöÆ÷for IEä¯ÀÀÆ÷
xmldoc.loadXML(txt);
//°Ñxml×Ö·û´´txtÔØÈë½âÎöÆ÷for firefoxµÈÆäËûä¯ÀÀÆ÷
var parser=new DOMParser();
var doc=parser.parsefromString(txt,"text/xml");
//Ò²¾ÍÊÇ˵IEʹÓÃloadXML()À´½âÎöXML×Ö·û´®£»firefoxÆäËûä¯ÀÀÆ÷ʹÓÃDOMParser¶ÔÏó
±éÀúµÃµ½xmlÎļþÖеÄÄÚÈÝ£º
function getvalue()
{
var person=xmldoc.getElementsByTagName("person");
for(i=0;i<person.length;i++)
{
var name=person[i].getElementsByTagName("name")[0].childNodes[0].nodeValue;
var age=person[i].getElementsByTagName("age")[0].childNodes[0].nodeValue;
document.write("name:"+name+" age:"+age+"<br>");
}
}
Ò²¿ÉÒÔͨ¹ýxmlhttpRequest¶ÔÏóLauren¶ÁÈ¡xmlÎļþ£¬Ê¹ÓÃopen()·½·¨Ê±ºòµÄurlµØÖ·¾ÍÊÇxmlÎļþµÄµØÖ·¡£
Á˽âXMLHTTPREQUEST¶ÔÏóµÄÓ÷¨£¬¿´ÕâÀïhttp://blog.csdn.net/popotans/archive/2009/11/16/4816690.aspx
x=xmlhttp.responseXML.documentElement.getElementsByTagName("CD");
for (i=0;i<x.length;i++)
{//do something here}
//ÕâÑù¿ÉÒÔÑ­»·±éÀú³öÿһ¸ö½ÚµãµÄÄÚÈÝ
µÃµ½Ä³¸öÔªËØ µÄÊôÐÔµÄÖµ£º
txt=xmlDoc.getElementsByTagName("title")[0].getAttribute("lang");
 ¸Ä±äÒ»¸öÔªËØµÄÎı¾Öµ£º
x=xmlDoc.getElementsByTagName("title")[0].childNodes[0];
x.nodeValue="Easy Cooking";
¸Ä±äÊôÐÔµÄÖµ£º
//setAttribute() ·½·¨¿ÉÓÃÓڸıäÒÑÓÐÊôÐÔµÄÖµ£¬»ò´´½¨Ò»¸öÐÂÊôÐÔ¡£
//ÏÂÃæµÄ´úÂëÏòÿ¸ö <book> ÔªËØÌí¼ÓÁËÃûΪ "edition" µÄÐÂÊôÐÔ£¨Öµ//ÊÇ "first"£©£º
x=xmlDoc.getElementsByTagName("book");
for(i=0;i<x.length;i++)
{
x[i].setAttribute("edition","first");
}

´´½¨ÔªËØ£º
createElement() ·½·¨´´½¨ÐµÄÔªËØ½Úµã¡£
createTextNode() ·½·¨´´½¨ÐµÄÎı¾½Úµã¡£
appendChild() ·½·¨Ïò½ÚµãÌí¼Ó×ӽڵ㣨ÔÚ×îºóÒ»¸ö×Ó½ÚµãÖ®ºó£©¡£
newel=xmlDoc.createElement("


Ïà¹ØÎĵµ£º

¾«Í¨JavaScript —— º¯ÊýÖØÔØºÍÀàÐͼì²é


ÆäËüÃæÏò¶ÔÏóµÄÓïÑÔÈçJAVAµÄÒ»¸ö³£¼ûÌØÐÔÊÇ£¬¸ù¾Ý´«ÈëµÄ²»Í¬ÊýÁ¿»òÀàÐ͵ģ¬Í¨¹ýÖØÔØ(overload) À´·¢»Ó²»Í¬µÄ¹¦Ó᣾¡¹ÜÕâ¸öÌØÐÔÔÚJavaScriptÖв¢Ã»ÓÐÖ±½ÓÖ§³Ö£¬Ò²Óкܶà°ì·¨Äܹ»ÊµÏÖ¡£
º¯ÊýÖØÔØ£¨function overloading£©±ØÐëÒÀÀµÁ½¼þÊÂÇ飺Åжϴ«Èë²ÎÊýµÄÊýÁ¿µÄÄÜÁ¦ºÍÅжϴ«Èë²ÎÊýÀàÐ͵ÄÄÜÁ¦¡£
JavaScript掅 ......

Google ÅÅÃûÖÐµÄ 10 ¸ö×îÖøÃûµÄ JavaScript ¿â

ugmbbc·¢²¼ÓÚ 2009-11-14 09:41:43| 7628 ´ÎÔĶÁ ×ÖÌ壺´ó С ´òÓ¡Ô¤ÀÀ
var ReTitle = '»Ø¸´:Google ÅÅÃûÖÐµÄ 10 ¸ö×îÖøÃûµÄ JavaScript ¿â';
¸ÐлCOMSHARP CMSµÄͶµÝ
ÐÂÎÅÀ´Ô´:tripwiremagazine.com
JavaScript ÊÇ Web ¿ª·¢ÓëÉè¼ÆÖв»¿É»òȱµÄ¶«Î÷£¬²»¹ÜÊÇÒ»¸ö¼òµ¥µÄÍøÒ³»¹ÊÇÒ»¸öרҵµÄÕ¾µã£¬Ò²²»¹ÜÄãÊǸßÊÖ»¹ÊDzËÄñ ......

JavaScriptÖеÄ×Ö·û´®²Ù×÷

 Ò»¡¢¸ÅÊö
    ×Ö·û´®ÔÚJavaScriptÖм¸ºõÎÞ´¦²»ÔÚ£¬ÔÚÄã´¦ÀíÓû§µÄÊäÈëÊý¾ÝµÄʱºò£¬ÔÚ¶ÁÈ¡»òÉèÖÃDOM¶ÔÏóµÄÊôÐÔʱ£¬ÔÚ²Ù×÷cookieʱ£¬µ±È»»¹Óиü¶à...¡£JavaScriptµÄºËÐIJ¿·ÖÌṩÁËÒ»×éÊôÐԺͷ½·¨ÓÃÓÚͨÓõÄ×Ö·û´®²Ù×÷£¬Èç·Ö¸î×Ö·û´®£¬¸Ä±ä×Ö·û´®µÄ´óСд£¬²Ù×÷×Ó×Ö·û´®µÈ¡£
    µ±Ç°µÄ ......

JavaScriptÖÐʹÓÃÔ­ÐÍÀ´´´½¨¶ÔÏó

ÔÚ±àд¹¹Ô캯Êýʱ£¬¿ÉÒÔʹÓÃÔ­ÐͶÔÏó£¨Ëü±¾ÉíÊÇËùÓй¹Ô캯ÊýµÄÒ»¸öÊôÐÔ£©µÄÊôÐÔÀ´´´½¨¼Ì³ÐÊôÐԺ͹²Ïí·½·¨¡£Ô­ÐÍÊôÐԺͷ½·¨½«°´ÒýÓø´ÖƸøÀàÖеÄÿ¸ö¶ÔÏó£¬Òò´ËËüÃǶ¼¾ßÓÐÏàͬµÄÖµ¡£¿ÉÒÔÔÚÒ»¸ö¶ÔÏóÖиü¸ÄÔ­ÐÍÊôÐÔµÄÖµ£¬ÐµÄÖµ½«¸²¸ÇĬÈÏÖµ£¬µ«½öÔÚ¸ÃʵÀýÖÐÓÐЧ¡£ÊôÓÚÕâ¸öÀàµÄÆäËû¶ÔÏó²»Êܴ˸ü¸ÄµÄÓ°Ïì¡£ÏÂÃæ¸ø³öÁËʹÓÃ×Ô¶¨Òå ......

Javascript »ñÈ¡Á´½Ó(url)²ÎÊýµÄ·½·¨

 ×÷Õß:
YITU.org    
À´Ô´:
YITU.org    

ʱ¼ä:
2007-02-26 10:34:58

ÓÐʱÎÒÃÇÐèÒªÔÚ¿Í»§¶Ë»ñÈ¡Á´½Ó²ÎÊý£¬Ò»¸ö³£¼ûµÄ·½·¨Êǽ«Á´½Óµ±×ö×Ö·û´®£¬°´ÕÕÁ´½ÓµÄ¸ñʽ·Ö½â£¬È»ºó»ñÈ¡¶ÔÓ¦µÄ²ÎÊýÖµ¡£±¾Îĸø³öµÄ¾ÍÊÇÕâ¸öÁ÷³ÌµÄ¾ßÌåʵÏÖ·½·¨¡£
µ±È»£¬ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ