Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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)


Ïà¹ØÎĵµ£º

JavascriptÎļþ¼°Îļþ¼Ð²Ù×÷

JavascriptÎļþ¼°Îļþ¼Ð²Ù×÷
 
Ò»¡¢¹¦ÄÜʵÏÖºËÐÄ£ºFileSystemObject ¶ÔÏó
    ÒªÔÚjavascriptÖÐʵÏÖÎļþ²Ù×÷¹¦ÄÜ£¬Ö÷Òª¾ÍÊÇÒÀ¿¿FileSystemobject¶ÔÏó¡£
¶þ¡¢FileSystemObject±à³Ì
ʹÓÃFileSystemObject ¶ÔÏó½øÐбà³ÌºÜ¼òµ¥£¬Ò»°ãÒª¾­¹ýÈçϵIJ½Ö裺 ´´½¨FileSystemObject¶ÔÏó¡¢Ó¦ÓÃÏà¹Ø·½·¨¡¢· ......

JavaScript¾­µäÓï¾ä¼°Æä»ù±¾Ó¦ÓÃ

¡ö´ò¿ª¡ö
<input name=Button onClick=document.all.WebBrowser.ExecWB(1,1) type=button value=´ò¿ª>
<OBJECT classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 id=WebBrowser width=0></OBJECT>
¡öÁí´æΪ¡ö
<input name=Button onClick=document.all.WebBrowser.ExecWB(4,1) typ ......

JavascriptÁ·Ï°ÊµÀý01:³Ë·¨¿Ú¾÷±íÓëɸѡËØÊý

<html>
<body>
<mce:script type="text/javascript"><!--
document.write("<table border=1px>");
for(i=1;i<=9;i++)
{document.write("<tr>");
for (j=1;j<=i;j++)
{document.write("<td class='table1'>"+i+"*"+j+"="+i*j+"&nbsp;&nbsp;& ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ