级别:<input type=text datasrc=#theXMLisland DataFLD=Grade size="76"><HR> <input id="first" TYPE=button value="<< 第一条记录" onclick="theXMLisland.recordset.moveFirst()"> <input id="prev" TYPE=button value="<上一条记录" onclick="theXMLisland.recordset.movePrevious()"> <input id="next" TYPE=button value="下一条记录>" onclick="theXMLisland.recordset.moveNext()"> <input id="last" TYPE=button value="最后一条记录>>" onclick="theXMLisland.recordset.moveLast()"> <input id="Add" TYPE=button value="添加新记录" onclick="theXMLisland.recordset.addNew()">
<XML ID="theXMLisland"> <HotelList> <Hotel> <Name>四海大酒店</Name> <Address>海魂路1号</Address> <HomePage>www.sihaohotel.com.cn</HomePage> <E-Mail>master@sihaohotel.com.cn</E-Mail> <TelePhone>(0989)8888888</TelePhone> <Grade>五星级</Grade> </Hotel> <Hotel> <Name>五湖宾馆</Name> <Address>东平路99号</Address> <HomePage>www.wuhu.com.cn</HomePage> <E-Mail>web@wuhu.com.cn</E-Mail> <TelePhone>(0979)1111666</TelePhone> <Grade>四星级</Grade> </Hotel> <Hotel> <Name>“大沙漠”宾馆</Name> <Address>留香路168号</Address> <HomePage>www.dashamohotel.com.cn</HomePage> <E-Mail>master@dashamohotel.com.cn</E-Mail> <TelePhone>(0989)87878788</TelePhone> <Grade>五星级</Grade> </Hotel> <Hotel> <Name>“画眉鸟”大酒店</Name> <Address>血海飘香路2号</Address> <HomePage>www.throstlehotel.com.cn</HomePage> <E-Mail>chuliuxiang@throstlehotel.com.cn</E-Mail> <TelePhone>(099)9886666</TelePhone> <Grade>五星级</Grade> </Hotel> </HotelList> </XML>
</body> </HTML> //xml数据岛中添加记录
------------------------------- The following list is a sample of the properties and methods that you use to access nodes in an XML
document.
Property/ Method Description XMLDocument Returns a reference to the XML Document Object Model (DOM) exposed by the object.
documentElement Returns the document root of the XML document. childNodes Returns a node list containing the children of a node (if any). item Accesses individual nodes within the list through an index. Index values are zero-based, so
item(0) returns the first child node. text Returns the text content of the node.
The following code shows an HTML page containing an XML data island. The data island is contained within
the <XML> element.
<HTML> <HEAD> <TITLE>HTML with XML Data Island</TITLE> </HEAD> <BODY> <P>Within this document is an XML data island.</P>
<XML ID="resortXML"> <resorts> <resort code='1'>Adventure Works</resort> <resort>Alpine Ski House</resort> </resorts> </XML>
</BODY> </HTML> For an example, you can cut and paste this sample line of code:
resortXML.XMLDocument.documentElement.childNodes.item(1).text//读取页面上的XML数据岛中的数据 resortXML.documentElement.childNodes.item(0).getAttribute("code")//读取页面上的XML数据岛中的数据 resortXML.documentElement.childNodes[0].getAttribute("code")//读取页面上的XML数据岛中的数据
199.模式窗口 父窗口 var url="aaa.jsp"; var
data=showModalDialog(url,null,"dialogHeight:400px;dialogHeight:600px;center:yes;help:No;status:no;resizab
le:Yes;edge:sunken"); if(data) alert(data.value); 子窗口 var data=new Object(); data.value1="china"; window.returnValue=data; window.close();
200.动态设置事件,带参数 <INPUT TYPE="text" NAME="a1"> <SCRIPT LANGUAGE="JavaScript"> <!-- function hah(para) { alert(para) } a1.onclick=function() { hah('canshu ') } //a1.attachEvent("onclick",function(){hah('参数')}); //--> </SCRIPT>//
如果您对本文有任何疑问或者建议,请到讨论区发表您的意见:
>>
论坛入口 <<
上一页 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1516 17 下一页
上一篇:Js之软键盘实现(源码) 下一篇:如何优化JavaScript脚本的性能
|