ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 读取XML数据到html中显示

读取XML数据到html中显示

原创 Linux操作系统 作者:fangqm 时间:2010-03-29 23:15:57 0 删除 编辑
建个A.HTML
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
http://www.w3.org/1999/xhtml">

    把XML里的数据读到HTML中并显示

start();

var xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async=false;
xmlDoc.load("email.xml");
function start()
{
var root=xmlDoc.documentElement;
todata.innerText=root.childNodes.item(0).text;
fromdata.innerText=root.childNodes.item(1).text;
ccdata.innerText=root.childNodes.item(2).text;
subjectdata.innerText=root.childNodes.item(3).text;
bodydata.innerText=root.childNodes.item(4).text;
}


To:
From:
CC:
Subject:
Body:


 
建个email.xml

  Bill_Pardi@hotmail.com
  Eric_Schurman@hotmail.com
  DHTML_in_Action@hotmail.com
  Basic email
  This is an XML-based email.

运行a.html,看到了吧,粗体部分为关键

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/23109131/viewspace-630722/ ,如需转载,请注明出处,否则将追究法律责任。

下一篇: 个人对接口理解
请登录后发表评论 登录
全部评论
创业项目 https://u.rscode.cn

注册时间:2010-03-24

  • 博文量
    297
  • 访问量
    784624