-- 作者:lt2000
-- 发布时间:5/9/2005 10:51:00 AM
-- 求跨帧使用xml数据岛的方法
在本帧显示xml数据岛米问题。但跨帧怎么使用? 各位指点一下小弟吧。 父帧文件 main.htm -------------------------------------------------------------------- <html> <head> <meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312"> <meta name="GENERATOR" content="Microsoft FrontPage 4.0"> <meta name="ProgId" content="FrontPage.Editor.Document"> <title>New Page 1</title> </head> <frameset rows="190,*"> <frame name="header" scrolling="no" target="main" src="top.htm"> <frame name="main" src="button.htm"> <noframes> <body> <p>此网页使用了框架,但您的浏览器不支持框架。</p> </body> </noframes> </frameset> </html> 带xml数据的文件 top.htm ---------------------------------------------------------------------------------------------- <html> <script language=javascript> function aaa() { //alert(document.all.theXMLisland.firstChild.childNodes(0).childNodes(0).Text) // alert(document.all.theXMLisland.recordset("Address").value) document.all.theXMLisland.recordset("Address").value="123456" } function movep() { if(document.all.theXMLisland.recordset.bof==0) theXMLisland.recordset.movePrevious() else alert("第一条") } function moven() { if(document.all.theXMLisland.recordset.eof==0) theXMLisland.recordset.moveNext() else alert("最后一条") } </script> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <meta name="GENERATOR" content="Microsoft FrontPage 4.0"> <meta name="ProgId" content="FrontPage.Editor.Document"> <title>New Page 2</title> <base target="main"> </head> <body> <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> <p><input type="button" value="按钮1" onclick=aaa() name="B3"> <input onclick="movep()" type="button" value="上一条" name="B4"> <input onclick="moven()" type="button" value="下一条" name="B5"> <input onclick="theXMLisland.recordset.addNew()" type="button" value="添加" name="B5"></p> <form method="POST" action="--WEBBOT-SELF--"> <!--webbot bot="SaveResults" U-File="fpweb:///_private/form_results.txt" S-Format="TEXT/CSV" S-Label-Fields="TRUE" --> <p><input type="text" datasrc=#theXMLisland DataFLD=NAME name="T1" size="20"></p> <p><input type="text" datasrc=#theXMLisland DataFLD=Address name="T2" size="20"></p> </form> <table datasrc=#theXMLisland border="1" width="36%"> <tr> <td width="50%"><div datafld="NAME"></div></td> <td width="50%"><div datafld="Address"></div></td> </tr> </table> </body> </html> 下帧欲显示xml的文件 ------------------------------------------------------------------------------------------------------ <html> <head> <meta http-equiv="Content-Language" content="zh-cn"> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <meta name="GENERATOR" content="Microsoft FrontPage 4.0"> <meta name="ProgId" content="FrontPage.Editor.Document"> <title>New Page 3</title> </head> <script language=javascript> function aaa() { //alert(document.all.theXMLisland.firstChild.childNodes(0).childNodes(0).Text) // alert(document.all.theXMLisland.recordset("Address").value) //window.parent.header.document.all.theXMLisland.recordset("Address").value="123456" alert(window.parent.header.document.all.theXMLisland.xml) } function movep() { if(document.all.theXMLisland.recordset.bof==0) theXMLisland.recordset.movePrevious() else alert("第一条") } function moven() { if(document.all.theXMLisland.recordset.eof==0) theXMLisland.recordset.moveNext() else alert("最后一条") } </script> <body> <form method="POST" action="--WEBBOT-SELF--"> <!--webbot bot="SaveResults" U-File="fpweb:///_private/form_results.txt" S-Format="TEXT/CSV" S-Label-Fields="TRUE" --> <p><input type="button" value="按钮1" onclick=aaa() name="B3"> <input onclick="movep()" type="button" value="上一条" name="B4"> <input onclick="moven()" type="button" value="下一条" name="B5"> <input onclick="theXMLisland.recordset.addNew()" type="button" value="添加" name="B5"></p> </form> <table datasrc=#theXMLisland border="1" width="36%"> <tr> <td width="50%"><div datafld="NAME"></div></td> <td width="50%"><div datafld="Address"></div></td> </tr> </table> </body> </html> </xml> 主要是下帧里面,xml的scr路径不会写,请指教
|