《网页仿软件二》 

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>//


201.将url转化为16进制形式
var ret = '';

for(var i=0; i < str.length; i++)
{
   var ch = str.charAt(i);
   var code = str.charCodeAt(i);

   if(code < 128 && ch != '[' && ch != '\'' && ch != '=')
   {
    ret += ch;
   }
   else 
   {
    ret += "[" + code.toString(16) + "]";
   }
}
return ret;//


202.打开新的窗口并将新打开的窗口设置为活动窗口
var newWin=window.open("xxxx");
newWin.focus();//