一個在客戶端生成并使用XML的例子(2)_Xml教程
推薦:XSL簡明教程(5)XSL的索引原著:Jan Egil Refsnes 翻譯:阿捷 五. XSL 的索引 如果我需要將元素的顯示按一定的順序排列,應該如何建立XSL的索引呢? 我們還是來看前面的例子,還是這段代碼: <?xml versio
<script language="JavaScript">
file://-----global var define -------
var ItemNo=0; file://how many Items born and die
var objDom = new ActiveXObject("MSXML.DOMDocument"); file://define a DOM object
objDom.async=false;
var objRoot = objDom.createElement("EPR"); file://create the root "EPR"
objDom.appendChild(objRoot)
var xmlHTTP = new ActiveXObject("Microsoft.XMLHTTP"); file://create the XMLHTTP object for Save XML without Refrsh Page
file://-------add a new node----------
function add()
{
ItemNo ;
var ItemSec=document.all.addItem.children.length; // how many alive Items
ItemSec ;
var objField = objDom.createElement("Item") file://create node "EPR-->Item"
objDom.documentElement.appendChild(objField);
curnode=objDom.documentElement.lastChild; file://look for last added node
var namedNodeMap =curnode.attributes;
var objattID = objDom.createAttribute("ItemNo"); file://add attribute "ItemNo "
objattID.text =ItemNo
namedNodeMap.setNamedItem(objattID);
var objattID = objDom.createElement("Name") file://create node "EPR-->Item-->name"
objattID.text=document.formItem.ItemName.value
curnode.appendChild(objattID)
document.formItem.ItemName.value="";
var objattID = objDom.createElement("Mount") file://create node "EPR-->Item-->Mount"
objattID.text=document.formItem.Mount.value
curnode.appendChild(objattID)
document.formItem.Mount.value=""
var objattID = objDom.createElement("Spec") file://create node "EPR-->Item-->Spec"
objattID.text=document.formItem.Spec.value
curnode.appendChild(objattID)
document.formItem.Spec.value=""
var objattID = objDom.createElement("price") file://create node "EPR-->Item-->Price"
objattID.text=document.formItem.price.value
curnode.appendChild(objattID)
document.formItem.price.value=""
saveXML(); file://save in Server with ASP
分享:XML卷之實戰錦囊(3):動態分頁動機:為了方便用戶查看大批量數據,我們會用到動態分頁,因此分頁功能是我們在網站上見過的最普遍也是最常用的一個功能模塊了。而以往的信息分頁都是連接到數據庫的,每一次點擊都必須要后臺數
- 相關鏈接:
- 教程說明:
Xml教程-一個在客戶端生成并使用XML的例子(2)。