惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

P
Proofpoint News Feed
博客园 - 聂微东
Application and Cybersecurity Blog
Application and Cybersecurity Blog
MyScale Blog
MyScale Blog
罗磊的独立博客
H
Help Net Security
L
LangChain Blog
T
Threat Research - Cisco Blogs
量子位
S
Securelist
Last Week in AI
Last Week in AI
L
Lohrmann on Cybersecurity
T
The Exploit Database - CXSecurity.com
P
Privacy International News Feed
The Hacker News
The Hacker News
Vercel News
Vercel News
D
Darknet – Hacking Tools, Hacker News & Cyber Security
C
Cybersecurity and Infrastructure Security Agency CISA
T
The Blog of Author Tim Ferriss
T
Threatpost
Security Latest
Security Latest
P
Palo Alto Networks Blog
Microsoft Security Blog
Microsoft Security Blog
NISL@THU
NISL@THU
F
Full Disclosure
WordPress大学
WordPress大学
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Stack Overflow Blog
Stack Overflow Blog
C
Check Point Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
酷 壳 – CoolShell
酷 壳 – CoolShell
H
Heimdal Security Blog
J
Java Code Geeks
Recorded Future
Recorded Future
Hugging Face - Blog
Hugging Face - Blog
G
GRAHAM CLULEY
Know Your Adversary
Know Your Adversary
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
阮一峰的网络日志
阮一峰的网络日志
U
Unit 42
B
Blog RSS Feed
月光博客
月光博客
C
Cisco Blogs
V
Visual Studio Blog
D
DataBreaches.Net
H
Hacker News: Front Page
博客园 - 叶小钗
N
News and Events Feed by Topic
爱范儿
爱范儿
A
Arctic Wolf

博客园 - SysInfo

[转]一个利用Sql Server 20005的 ROW_NUMBER Function 的分页存储过程. 新域名注册成功.http://sysinfo.com.cn/ 如何在上传图片之前预览图片? - SysInfo - 博客园 asp.net执行.sql文件 - SysInfo - 博客园 The New Controls of ASP.NET 2.0 Installing the ASP.NET "Atlas" Wiki - SysInfo [转]常见的 Web 项目转换问题及解决方案 今天下午回家:提前给大家拜个年! [转]MSN消息提示类(纯js编写) - SysInfo - 博客园 window对象的status、location、name、self、opener属性的使用 RadioButton加入DataGrid模板列引起的问题。 疙瘩汤 NHibernate Response.BinaryWrite()下载时文件名的问题. 细说HTML元素的ID和Name属性的区别 收藏 用JavaScript解决ASP.NET服务器控件造成的刷新问题 为.net中的ListBox控件添加双击事件 子父窗口之间的操作之小例子
用实例说明如何用JavaScript生成XML
SysInfo · 2005-11-17 · via 博客园 - SysInfo

  1 <script language="javascript"> 
  2 <!-- 
  3 var doc = new ActiveXObject("Msxml2.DOMDocument"); //ie5.5+,CreateObject("Microsoft.XMLDOM")  
  4 
  5 
  6 //加载文档 
  7 //doc.load("b.xml"); 
  8 
  9 //创建文件头 
 10 var p = doc.createProcessingInstruction
 11 ("xml","version=’’1.0’’  
 12 encoding=’’gb2312’’"); 
 13 
 14     //添加文件头 
 15     doc.appendChild(p); 
 16 
 17 //用于直接加载时获得根接点 
 18 //var root = doc.documentElement; 
 19 
 20 //两种方式创建根接点 
 21 //    var root = 
 22 doc.createElement("students"); 
 23     var root = doc.createNode(1,"students",""); 
 24 
 25     //创建子接点 
 26     var n = doc.createNode(1,"ttyp",""); 
 27 
 28         //指定子接点文本 
 29         //n.text = " this is a test"; 
 30      
 31     //创建孙接点 
 32     var o = doc.createElement("sex"); 
 33         o.text = "";    
 34         //指定其文本 
 35 
 36     //创建属性 
 37     var r = doc.createAttribute("id"); 
 38         r.value="test"
 39 
 40         //添加属性 
 41         n.setAttributeNode(r); 
 42 
 43     //创建第二个属性     
 44     var r1 = doc.createAttribute("class"); 
 45         r1.value="tt"
 46          
 47         //添加属性 
 48         n.setAttributeNode(r1); 
 49 
 50         //删除第二个属性 
 51         n.removeAttribute("class"); 
 52 
 53         //添加孙接点 
 54         n.appendChild(o); 
 55 
 56         //添加文本接点 
 57         n.appendChild(doc.createTextNode
 58         ("this is a text node.")); 
 59 
 60         //添加注释 
 61         n.appendChild(doc.createComment
 62         ("this is a comment\n")); 
 63      
 64         //添加子接点 
 65         root.appendChild(n); 
 66      
 67     //复制接点 
 68     var m = n.cloneNode(true); 
 69 
 70         root.appendChild(m); 
 71          
 72         //删除接点 
 73         root.removeChild(root.childNodes(0)); 
 74 
 75     //创建数据段 
 76     var c = doc.createCDATASection
 77     ("this is a cdata"); 
 78         c.text = "hi,cdata"
 79         //添加数据段 
 80         root.appendChild(c); 
 81      
 82     //添加根接点 
 83     doc.appendChild(root); 
 84 
 85     //查找接点 
 86     var a = doc.getElementsByTagName("ttyp"); 
 87     //var a = doc.selectNodes("//ttyp"); 
 88 
 89     //显示改接点的属性 
 90     for(var i= 0;i<a.length;i++
 91     { 
 92         alert(a[i].xml); 
 93 for(var j=0;j<a[i].attributes.length;j++
 94         { 
 95             alert(a[i].attributes[j].name); 
 96         } 
 97     } 
 98 
 99     //XML保存(需要在服务端,客户端用FSO) 
100     //doc.save(); 
101      
102     //查看根接点XML 
103     if(n) 
104     { 
105         alert(n.ownerDocument.xml); 
106     } 
107 
108 //--> 
109 </script>