52,797
社区成员
发帖
与我相关
我的任务
分享
var i=0;
function fireTimer(thistable) {
//判断加载次数
if(i==2 && thistable.readyState=="complate")
{
//处理事件
}
else
{
i++;
}
}
<html>
<head>
<script>
var i=0;
function fireTimer(thistable) {
var value=document.all.testtext.value;
value+="-->"+i+thistable.id+":"+thistable.readyState;
document.all.testtext.value=value;
i++;
}
function addLine(){
document.all.Textarea1.value=document.all.testtext.value;
document.all.testtext.value="";
var ds1 = document.getElementById('xmlData1');
var xpath="/root/outout/PageList";
var node=ds1.selectSingleNode(xpath);
var node1=ds1.selectSingleNode("/root/outout");
node1.appendChild(node.cloneNode(true));
}
function loadXml(){
var ds1 = document.getElementById('xmlData1');
ds1.loadXML(ds1.xml);
}
</script>
</head>
<body>
<xml id="xmlData1">
<root>
<outout>
<PageList>
<PageData>
<checkFlag>1 </checkFlag>
<AUTHOR>John Smith </AUTHOR>
<GENERATOR>Visual Notepad </GENERATOR>
<tagDataList>
<tagData>
<id>201 </id>
<name>asdf </name>
</tagData>
<tagData>
<id>201 </id>
<name>asdf </name>
</tagData>
<tagData>
<id>201 </id>
<name>asdf </name>
</tagData>
</tagDataList>
</PageData>
</PageList>
</outout>
</root>
</xml>
<table>
<tr>
<td>
第一次:
<textarea id="Textarea1" cols="100" rows="5"></textarea>
<input onclick="addLine();" type="button" value="addLine">
<input onclick="loadXml();" type="button" value="loadXml">
<textarea id="testtext" cols="100" rows="5"></textarea>
</td>
</tr>
</table>
<table datasrc="#xmlData1" datafld="root" onreadystatechange="fireTimer(this)" id="root">
<tr>
<td>
<table datasrc="#xmlData1" datafld="outout" onreadystatechange="fireTimer(this)"
id="outout">
<tr>
<td>
<table datasrc="#xmlData1" datafld="PageList" onreadystatechange="fireTimer(this)"
id="PageList">
<tr>
<td>
<table datasrc="#xmlData1" datafld="PageData" width="100%" border="1" onreadystatechange="fireTimer(this)"
id="PageData">
<thead>
<tr>
<th width="10%">
选择
</th>
<th width="20%">
作者
</th>
<th width="30%">
工具
</th>
<th>
详细信息1
</th>
<th>
详细信息2
</th>
</tr>
</thead>
<tr>
<td>
<input type="checkbox" datafld="checkFlag" onreadystatechange="fireTimer(this)" id="checkFlag" />
</td>
<td>
<span datafld="AUTHOR" onreadystatechange="fireTimer(this)" id="AUTHOR"></span>
</td>
<td>
<span datafld="GENERATOR" onreadystatechange="fireTimer(this)" id="GENERATOR"></span>
</td>
<td>
<table datasrc="#xmlData1" datafld="tagDataList" width="100%" onreadystatechange="fireTimer(this)"
id="tagDataList">
<tr>
<td>
<table datasrc="#xmlData1" datafld="tagData" width="100%" onreadystatechange="fireTimer(this)"
id="tagData">
<tr>
<td>
<input type="checkBox" datafld="id" id="9999" onreadystatechange="fireTimer(this)"
id="id" />
</td>
<td>
<span datafld="name" onreadystatechange="fireTimer(this)" id="name"></span>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<script>
function fireTimer(thistable) {
var value=document.all.testtext.value;
value+="-->"+thistable.id+":"+thistable.readyState;
document.all.testtext.value=value;
}
function addLine(){
document.all.Textarea1.value=document.all.testtext.value;
document.all.testtext.value="";
var ds1 = document.getElementById('xmlData1');
var xpath="/root/outout/PageList";
var node=ds1.selectSingleNode(xpath);
var node1=ds1.selectSingleNode("/root/outout");
node1.appendChild(node.cloneNode(true));
}
function loadXml(){
var ds1 = document.getElementById('xmlData1');
ds1.loadXML(ds1.xml);
}
</script>
</head>
<body>
<xml id="xmlData1">
<root>
<outout>
<PageList>
<PageData>
<checkFlag>1 </checkFlag>
<AUTHOR>John Smith </AUTHOR>
<GENERATOR>Visual Notepad </GENERATOR>
<tagDataList>
<tagData>
<id>201 </id>
<name>asdf </name>
</tagData>
<tagData>
<id>201 </id>
<name>asdf </name>
</tagData>
<tagData>
<id>201 </id>
<name>asdf </name>
</tagData>
</tagDataList>
</PageData>
</PageList>
</outout>
</root>
</xml>
<table>
<tr>
<td>
第一次:
<textarea id="Textarea1" cols="100" rows="5"></textarea>
<input onclick="addLine();" type="button" value="addLine">
<input onclick="loadXml();" type="button" value="loadXml">
<textarea id="testtext" cols="100" rows="5"></textarea>
</td>
</tr>
</table>
<table datasrc="#xmlData1" datafld="root" onreadystatechange="fireTimer(this)" id="root">
<tr>
<td>
<table datasrc="#xmlData1" datafld="outout" onreadystatechange="fireTimer(this)"
id="outout">
<tr>
<td>
<table datasrc="#xmlData1" datafld="PageList" onreadystatechange="fireTimer(this)"
id="PageList">
<tr>
<td>
<table datasrc="#xmlData1" datafld="PageData" width="100%" border="1" onreadystatechange="fireTimer(this)"
id="PageData">
<thead>
<tr>
<th width="10%">
选择
</th>
<th width="20%">
作者
</th>
<th width="30%">
工具
</th>
<th>
详细信息1
</th>
<th>
详细信息2
</th>
</tr>
</thead>
<tr>
<td>
<input type="checkbox" datafld="checkFlag" onreadystatechange="fireTimer(this)" id="checkFlag" />
</td>
<td>
<span datafld="AUTHOR" onreadystatechange="fireTimer(this)" id="AUTHOR"></span>
</td>
<td>
<span datafld="GENERATOR" onreadystatechange="fireTimer(this)" id="GENERATOR"></span>
</td>
<td>
<table datasrc="#xmlData1" datafld="tagDataList" width="100%" onreadystatechange="fireTimer(this)"
id="tagDataList">
<tr>
<td>
<table datasrc="#xmlData1" datafld="tagData" width="100%" onreadystatechange="fireTimer(this)"
id="tagData">
<tr>
<td>
<input type="checkBox" datafld="id" id="9999" onreadystatechange="fireTimer(this)"
id="id" />
</td>
<td>
<span datafld="name" onreadystatechange="fireTimer(this)" id="name"></span>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>