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

javascript²Ù×÷XmlÔöɾ¸Ä²é(IEÏÂ)

HTMLÎļþ£º
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>js²Ù×÷XmlÔöɾ¸Ä²é(IEÏÂ)</title>
<script type="text/javascript"><!--
/*µÈ½â¾öµÄÎÊÌâ:
1.xpathµ½µ×ÊǶ¨Î»µ½ÄÄÒ»²ã,ÔõÑù¶¨Î»µ½±ÈÈçrootÕâÒ»¼¶»¹ÊÇperson»ònameÕâÒ»¼¶.
*/
var xmlDoc;
var rootNode; //¸ù½áµã
//×°ÔØXmlÎĵµ
function loadXml(){
try{
xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async=false;//¹Ø±ÕÒì²½¼ÓÔØ
xmlDoc.load("XmlFile.xml");//loadÊÇ´ÓÎļþ,loadXMLÊÇ´Ó×Ö·û´®.
rootNode = xmlDoc.documentElement;
}catch(e) {alert(e.message)}
}
//ÏÔʾÄÚ´æÖеÄXmlÎĵµ
function outXml(){
var divXml=document.getElementById("divXml");
divXml.innerHTML=xmlDoc.xml;//ÏÔʾxmlÄÚÈÝ,¼¼ÇÉÊǼӸöxmlºó׺.?
alert(xmlDoc.xml);
}
//Ôö
function addXml(){
//Ò¶×Ó½áµã,ÉèÖÃtextÖµ
var newName = xmlDoc.createElement("name");
newName.text = "crane";
var newGender = xmlDoc.createElement("gender");
newGender.text = "female";
//¸¸¼¶½áµã,ÓÃappendChild(childNode);
var newPerson = xmlDoc.createElement("person");
//ÉèÖÃÊôÐÔid
newPerson.setAttribute("id","2");
newPerson.appendChild(newName);
newPerson.appendChild(newGender);
//Ôö¼Óµ½¸ù½áµã
rootNode.appendChild(newPerson);
alert(xmlDoc.xml);
}
//ɾ
function deleteXml(){
//ÏÈÕÒµ½½áµã
var singleNode = xmlDoc.selectSingleNode("/root/person[name='tree']");
//ÕÒµ½¸¸¼¶ÔÙɾ³ý
singleNode.parentNode.removeChild(singleNode);
alert(xmlDoc.xml)


Ïà¹ØÎĵµ£º

[·­Òë]High Performance JavaScript(033)

Summary  ×ܽá
    When web pages or applications begin to feel slow, analyzing assets as they come over the wire and profiling scripts while they are running allows you to focus your optimization efforts where they are needed most.
    µ±ÍøÒ³»òÓ¦ÓóÌÐò±äÂýʱ£¬·ÖÎ ......

jLayout — JavaScript Layout Algorithms


The jLayout JavaScript library provides layout algorithms for laying out components. A component is an abstraction; it can be implemented in many ways, for example as items in a HTML5 Canvas drawing or as HTML elements. The jLayout library allows you to focus on drawing the individual components i ......

JavaScriptÖÐconfirm,alert,promptµÄÓ÷¨

±¾ÎļòÒª½éÉÜJavaScriptÖÐconfirm,alert,promptµÄÓ÷¨,Ï£Íû´ó¼Òѧϰ¹ý³ÌÖÐÄܵõ½Ò»Ð©Æô·¢¡£
window.confirm ²ÎÊý¾ÍÖ»ÓÐÒ»¸ö¡£ÏÔʾÌáʾ¿òµÄÐÅÏ¢¡£°´È·¶¨,·µ»Øtrue£»°´È¡Ïû·µ»Øfalse¡£
< SCRIPT> var bln = window.confirm("È·¶¨Âð?"); alert(bln) < /SCRIPT> window.alert²ÎÊý£¬Ö»ÓÐ ......

href=¡°#¡±Óëhref=¡°javascript:void(0)¡±Çø±ð

ʹÓùýajaxµÄ¶¼³£¼ûÕâÑùµÄ´úÂ룺
<a href="javascript:doTest2();void(0);" mce_href="javascript:doTest2();void(0);">here</a>
µ«Õâ¶ùµÄvoid(0)¾¿¾¹ÊǺκ¬ÒåÄØ£¿
JavascriptÖÐvoidÊÇÒ»¸ö²Ù×÷·û£¬¸Ã²Ù×÷·ûÖ¸¶¨Òª¼ÆËãÒ»¸ö±í´ïʽµ«ÊDz»·µ»ØÖµ¡£
void ²Ù×÷·ûÓ÷¨¸ñʽÈçÏ£º
1. jav ......

javaScript»ñÈ¡¶ÔÏ󼯺ϣ¨ÁíÒ»ÖÖ·½·¨£©

³ýÁËÓÃgetElementByTagName   µÄÁíÒ»ÖÖ»ñÈ¡¶ÔÏ󼯺ϵķ½·¨
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" conte ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ