我刚从mantascode复制程序,现在我编辑了.. [英] i just copied the program from mantascode and now am edited it..

查看:52
本文介绍了我刚从mantascode复制程序,现在我编辑了..的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的xml文件..

this is my xml file..

<?xml version="1.0"?>
<catalog>
   <book id="bk101">
      <author>GambardellaMatthew</author>
      <title>XMLDevelopersGuide</title>
      <genre>Computer</genre>
      <price>44.95</price>
      <publish_date>2000-10-01</publish_date>
      <description>An in-depth look at creating applications
      with XML.</description>
   </book>
   <book id="bk102">
      <author>RallsKim</author>
      <title>MidnightRain</title>
      <genre>Fantasy</genre>
      <price>5.95</price>
      <publish_date>2000-12-16</publish_date>
      <description>A former architect battles corporate zombies,
      an evil sorceress, and her own childhood to become queen
      of the world.</description>
   </book>
   <book id="bk103">
      <author>CoretsEva</author>
      <title>MaeveAscendant</title>
      <genre>Fantasy</genre>
      <price>5.95</price>
      <publish_date>2000-11-17</publish_date>
      <description>After the collapse of a nanotechnology
      society in England, the young survivors lay the
      foundation for a new society.</description>
   </book>
   <book id="bk104">
      <author>CoretsEva</author>
      <title>OberonsLegacy</title>
      <genre>Fantasy</genre>
      <price>5.95</price>
      <publish_date>2001-03-10</publish_date>
      <description>In post-apocalypse England, the mysterious
      agent known only as Oberon helps to create a new life
      for the inhabitants of London. Sequel to Maeve
      Ascendant.</description>
   </book>
   </catalog>



及以下这里是offline.html


and below here is offline.html

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Search local storage</title>
</head>
<body>
<form action="offline.html" method="get" >
  Search By Author : <input type="text" name="txtA" /><br />
  <input type="submit" value="Submit"  />
</form>
<br />
<br />
<div id="results_ID"></div>
<script type="text/javascript">
var localStorageRow = localStorage.getItem(localStorage.key(i)) ;
var author_query = getUrlVars()["txtA"];
var s,s1,s2,s3;
s="";s1="";s2="";s3="";
if (typeof(author_query) == "undefined" || author_query === " " )
{
}
else
{
for ( var i = 0 ; i < localStorage.length;  i++)

{

var localStorageRow = localStorage.getItem(localStorage.key(i)) ;



if (window.DOMParser)

{

parser=new DOMParser();

xmlDoc=parser.parseFromString(localStorageRow,"text/xml");

}

else // Internet Explorer

{

xmlDoc=new ActiveXObject("Microsoft.XMLDOM");

xmlDoc.async=false;

xmlDoc.loadXML(localStorageRow);

xmlDoc.Save("books.xml");

}



for ( var k = 0 ; k < xmlDoc.firstChild.childNodes.length ; k++ )

{

if ( xmlDoc.firstChild.childNodes[k].nodeName === "author" )

{



var auth_row = xmlDoc.firstChild.childNodes[k].textContent;

var authMatch = auth_row.match(new RegExp(author_query, "i"));

if ( authMatch )

{



for ( var p = 0 ; p < xmlDoc.firstChild.childNodes.length ; p ++ )

{

if ( xmlDoc.firstChild.childNodes[p].nodeName == 'title' )

{

fsname =xmlDoc.firstChild.childNodes[p].textContent;



s="<td><INPUT TYPE='button' value='" +  fsname + "' onclick=showLargeimage('" +  fsname + "')></td>" ;
s = fsname  + s;
}
}
document.getElementById("results_ID").innerHTML =s;
alert (s);
 }
}
}
}
}
function showLargeimage(str)
{
myWindow=window.open('editxmlnew.html','','width=600,height=700');
opener.document.getElementById("txtA").value = txt;
myWindow.focus();
}


function Save(str){
alert("hi");
}

function getUrlVars() {
var vars = {};
var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {
vars[key] = value;
});
return vars;
}

</script>
 </body>
</html>

推荐答案

这不是问题..正确指定您的问题。我正在报告你的问题为非Quetsion
Its not a question.. Specify your question correctly.. I''m reporting your question as "Not a Quetsion"


这篇关于我刚从mantascode复制程序,现在我编辑了..的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆