XSLT存档  

不及格的程序员-八神

 查看分类:  ASP.NET XML/XSLT JavaScripT   我的MSN空间Blog
数据岛
发表于2006年08月1日由不及格的程序员-八神
星期二 天气:暴雨转中雨
 
从今天半夜就开始下了 早上爸送我来的
雨好大啊
 
数数岛分页
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>不及格的程序员-八神</TITLE>
<META http-equiv="Content-Type" content="text/html; charset=gb2312">
<META NAME="Generator" CONTENT="Wawa Editor 1.0">
<META NAME="Author" CONTENT="八神奄,海格雷尔,JavaX,杨林">
<META NAME="Keywords" CONTENT="Javascript,Java,XML,XSLT,ASP,VBScript,ASP .Net,C#,C++,Database,不及格的程序员">
<META NAME="Description" CONTENT="不及格的程序员,无所不在">
</HEAD>
<BODY>
<xml id="xmlData">
<?xml version="1.0" encoding="gb2312" ?>
 <datas>
  <dataRow>
   <id>1</id>
   <check></check>
   <name>Iori</name>
   <alias>Yagami</alias>
  </dataRow>
  <dataRow>
   <id>2</id>
   <check></check>
   <name>Athena</name>
   <alias>Asamiya</alias>
  </dataRow>
  <dataRow>
   <id>3</id>
   <check></check>
   <name>Kyo</name>
   <alias>Kusanag</alias>
  </dataRow>
  <dataRow>
   <id>4</id>
   <check></check>
   <name>Mai</name>
   <alias>Shiranui</alias>
  </dataRow>
  <dataRow>
   <id>5</id>
   <check></check>
   <name>Kasumi</name>
   <alias>Todo</alias>
  </dataRow>
 </datas>
</xml>
<table bgcolor="menu" border="1" datasrc="#xmlData" id="ListTable" DATAPAGESIZE="2">
 <thead>
  <th>ID</th>
  <th>状态</th>
  <th>名子</th>
  <th>别名</th>
 </thead>
 <tbody>
 <tr>
  <td><span dataFld="id"></span></td>
  <td><input type="checkbox" name="chb_Control"/></td>
  <td><span dataFld="name"></span></td>
  <td><span dataFld="alias"></span></td>
 </tr>
 </tbody>
</table>
<input type="button" onclick="ListTable.firstPage()" value="First">
<input type="button" onclick="ListTable.previousPage()" value="Pre">
<input type="button" onclick="ListTable.nextPage()" value="Next">
<input type="button" onclick="ListTable.lastPage()" value="Last">
<br><input type="button" value="Update" onclick="GetData()">
<script>
 function GetData(){
  var xmlDoc = document.getElementById("xmlData");
  var xmlNewDoc = new ActiveXObject("Msxml2.DOMDocument");
  xmlNewDoc.loadXML("<datas><dataRow><id>1</id><name>八神</name><alias>奄</alias></dataRow></datas>");
  xmlDoc.documentElement = xmlNewDoc.documentElement
 }
 
</script>
</BODY>
</BODY>
</HTML>
 
简单应用,调整位置
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE></TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
<script language="javascript1.2" for="window" event="onload">
 page = new Object();
 page.content = this;
 singleCheck = false;
</script>
<script language="javascript1.2" for="orderUpButton" event="onclick">
 var currentTable = null;
 var currentRow = null;
 var selCheck= new Array();
 singleCheck = false;
 var allCheckbox = window.getCustomCheckbox("FORM1");
 for(var i=0;i<allCheckbox.length;i++){
  if(allCheckbox[i].checked){
   singleCheck = true;
   selCheck[selCheck.length] = allCheckbox[i];
   currentRow = getParentNode(allCheckbox[i],"TR");
   currentTable = getParentNode(currentRow,"TABLE")
   if(currentRow.rowIndex > 1){
    currentRow.swapNode(currentTable.rows[currentRow.rowIndex-1]);
   }
  }
 }
 if(singleCheck!=true){
  alert("请选择一个选项.");
  return false;
 }
 for(var i=0;i<selCheck.length;i++){
  selCheck[i].checked = true;
 }
</script>
<script language="javascript1.2" for="orderDownButton" event="onclick">
 var currentTable = null;
 var currentRow = null;
 var selRows = new Array();
 var selCheck= new Array();
 singleCheck = false;
 var allCheckbox = window.getCustomCheckbox("FORM1");
 for(var i=0;i<allCheckbox.length;i++){
  if(allCheckbox[i].checked){
   singleCheck = true;
   currentRow = getParentNode(allCheckbox[i],"TR");
   selCheck[selCheck.length] = allCheckbox[i];
   selRows[selRows.length] = currentRow;
  }
 }
 if(singleCheck!=true){
  alert("请选择一个选项.");
  return false;
 }
 currentTable = getParentNode(currentRow,"TABLE");
 for(var i=selRows.length;i>0;i–){
  if(selRows[i-1].rowIndex < currentTable.rows.length-1){
   var swapped = selRows[i-1].swapNode(currentTable.rows[selRows[i-1].rowIndex+1]);
  }
 }
 for(var i=0;i<selCheck.length;i++){
  selCheck[i].checked = true;
 }
</script>
<script language="javascript1.2" for="checkAllButton" event="onclick">
 var allCheckbox = window.getCustomCheckbox("FORM1");
 if(this.innerHTML=="全选"){
  for(var i=0;i<allCheckbox.length;i++){
   allCheckbox[i].checked = true;
  }
  this.innerHTML = "取消";
 }else{
  for(var i=0;i<allCheckbox.length;i++){
   allCheckbox[i].checked = false;
  }
  this.innerHTML = "全选"; 
 }
</script>
<script language="javascript1.2" for="delButton" event="onclick">
  var allCheckbox = window.getCustomCheckbox("FORM1");
  if(!window.confirm("确认要删除吗?")) return false;
  for(var i=0;i<allCheckbox.length;i++){
   if(allCheckbox[i].checked==true){
    var currentRow = getParentNode(allCheckbox[i],"TR");
    var currentTable = getParentNode(currentRow,"TABLE");
    currentTable.deleteRow(currentRow.rowIndex);
   }
  }
</script>
<script language="javascript1.2">
 function getParentNode(objHtml,tagName){
  var parentNode = objHtml.parentNode;
  while(parentNode.tagName!=tagName){
   parentNode = parentNode.parentNode;
  }
  return parentNode;
 }
 window.getCustomCheckbox = function(strFormName){
  var allCheckbox = new Array();
  var allInput = document.forms[strFormName].tags("INPUT");
  for(var i=0;i<allInput.length;i++){
   if(allInput[i].type=="checkbox"&&allInput[i].id.substring(0,3)=="chb"){
    allCheckbox[allCheckbox.length] = allInput[i];
   }
  }
  return allCheckbox;
 }
</script>
</HEAD>
<BODY>
<xml id="xmlData">
<?xml version="1.0" encoding="gb2312" ?>
 <datas>
  <dataRow>
   <id>1</id>
   <check></check>
   <name>Iori</name>
   <alias>Yagami</alias>
  </dataRow>
  <dataRow>
   <id>2</id>
   <check></check>
   <name>Athena</name>
   <alias>Asamiya</alias>
  </dataRow>
  <dataRow>
   <id>3</id>
   <check></check>
   <name>Kyo</name>
   <alias>Kusanag</alias>
  </dataRow>
  <dataRow>
   <id>4</id>
   <check></check>
   <name>Mai</name>
   <alias>Shiranui</alias>
  </dataRow>
  <dataRow>
   <id>5</id>
   <check></check>
   <name>Kasumi</name>
   <alias>Todo</alias>
  </dataRow>
 </datas>
</xml>
<table bgcolor="menu" border="1" datasrc="#xmlData">
 <thead>
  <th>ID</th>
  <th>状态</th>
  <th>菜单</th>
  <th>别名</th>
 </thead>
 <tbody>
 <tr>
  <td><span dataFld="id"></span></td>
  <td><input type="checkbox" name="chb_Control"/></td>
  <td><span dataFld="name"></span></td>
  <td><span dataFld="alias"></span></td>
 </tr>
 </tbody>
</table>
<br/>
<FORM NAME="FORM1" METHOD="POST">
<table bgcolor="menu" border="1">
 <thead>
  <th>ID</th>
  <th>状态</th>
  <th>菜单</th>
  <th>别名</th>
 </thead>
 <tbody>
 <tr>
  <td>01</td>
  <td align="center"><input type="checkbox" id="chb_01"/></td>
  <td><label for="chb_01">Iori</label></td>
  <td>i</td>
 </tr>
 <tr>
  <td>02</td>
  <td align="center"><input type="checkbox" id="chb_02"/></td>
  <td><label for="chb_02">Terry</label></td>
  <td>t</td>
 </tr>
 <tr>
  <td>03</td>
  <td align="center"><input type="checkbox" id="chb_03"/></td>
  <td><label for="chb_03">Anndy</label></td>
  <td>a</td>
 </tr>
 <tr>
  <td>04</td>
  <td align="center"><input type="checkbox" id="chb_04"/></td>
  <td><label for="chb_03">Jonny</label></td>
  <td>a</td>
 </tr>
 </tbody>
</table>
<hr>
<button style="width=35" id="checkAllButton">全选</button>
<button style="width=30" id="orderUpButton"></button>
<button style="width=30" id="orderDownButton"></button>
<button style="width=35" id="delButton"> 删除 </button>
</FORM>
</BODY>
</HTML>

 

数据岛

星期二 天气:暴雨转中雨
 
从今天半夜就开始下了 早上爸送我来的
雨好大啊
 
数数岛分页
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>不及格的程序员-八神</TITLE>
<META http-equiv="Content-Type" content="text/html; charset=gb2312">
<META NAME="Generator" CONTENT="Wawa Editor 1.0">
<META NAME="Author" CONTENT="八神奄,海格雷尔,JavaX,杨林">
<META NAME="Keywords" CONTENT="Javascript,Java,XML,XSLT,ASP,VBScript,ASP .Net,C#,C++,Database,不及格的程序员">
<META NAME="Description" CONTENT="不及格的程序员,无所不在">
</HEAD>
<BODY>
<xml id="xmlData">
<?xml version="1.0" encoding="gb2312" ?>
 <datas>
  <dataRow>
   <id>1</id>
   <check></check>
   <name>Iori</name>
   <alias>Yagami</alias>
  </dataRow>
  <dataRow>
   <id>2</id>
   <check></check>
   <name>Athena</name>
   <alias>Asamiya</alias>
  </dataRow>
  <dataRow>
   <id>3</id>
   <check></check>
   <name>Kyo</name>
   <alias>Kusanag</alias>
  </dataRow>
  <dataRow>
   <id>4</id>
   <check></check>
   <name>Mai</name>
   <alias>Shiranui</alias>
  </dataRow>
  <dataRow>
   <id>5</id>
   <check></check>
   <name>Kasumi</name>
   <alias>Todo</alias>
  </dataRow>
 </datas>
</xml>
<table bgcolor="menu" border="1" datasrc="#xmlData" id="ListTable" DATAPAGESIZE="2">
 <thead>
  <th>ID</th>
  <th>状态</th>
  <th>名子</th>
  <th>别名</th>
 </thead>
 <tbody>
 <tr>
  <td><span dataFld="id"></span></td>
  <td><input type="checkbox" name="chb_Control"/></td>
  <td><span dataFld="name"></span></td>
  <td><span dataFld="alias"></span></td>
 </tr>
 </tbody>
</table>
<input type="button" onclick="ListTable.firstPage()" value="First">
<input type="button" onclick="ListTable.previousPage()" value="Pre">
<input type="button" onclick="ListTable.nextPage()" value="Next">
<input type="button" onclick="ListTable.lastPage()" value="Last">
<br><input type="button" value="Update" onclick="GetData()">
<script>
 function GetData(){
  var xmlDoc = document.getElementById("xmlData");
  var xmlNewDoc = new ActiveXObject("Msxml2.DOMDocument");
  xmlNewDoc.loadXML("<datas><dataRow><id>1</id><name>八神</name><alias>奄</alias></dataRow></datas>");
  xmlDoc.documentElement = xmlNewDoc.documentElement
 }
 
</script>
</BODY>
</BODY>
</HTML>
 
简单应用,调整位置
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE></TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
<script language="javascript1.2" for="window" event="onload">
 page = new Object();
 page.content = this;
 singleCheck = false;
</script>
<script language="javascript1.2" for="orderUpButton" event="onclick">
 var currentTable = null;
 var currentRow = null;
 var selCheck= new Array();
 singleCheck = false;
 var allCheckbox = window.getCustomCheckbox("FORM1");
 for(var i=0;i<allCheckbox.length;i++){
  if(allCheckbox[i].checked){
   singleCheck = true;
   selCheck[selCheck.length] = allCheckbox[i];
   currentRow = getParentNode(allCheckbox[i],"TR");
   currentTable = getParentNode(currentRow,"TABLE")
   if(currentRow.rowIndex > 1){
    currentRow.swapNode(currentTable.rows[currentRow.rowIndex-1]);
   }
  }
 }
 if(singleCheck!=true){
  alert("请选择一个选项.");
  return false;
 }
 for(var i=0;i<selCheck.length;i++){
  selCheck[i].checked = true;
 }
</script>
<script language="javascript1.2" for="orderDownButton" event="onclick">
 var currentTable = null;
 var currentRow = null;
 var selRows = new Array();
 var selCheck= new Array();
 singleCheck = false;
 var allCheckbox = window.getCustomCheckbox("FORM1");
 for(var i=0;i<allCheckbox.length;i++){
  if(allCheckbox[i].checked){
   singleCheck = true;
   currentRow = getParentNode(allCheckbox[i],"TR");
   selCheck[selCheck.length] = allCheckbox[i];
   selRows[selRows.length] = currentRow;
  }
 }
 if(singleCheck!=true){
  alert("请选择一个选项.");
  return false;
 }
 currentTable = getParentNode(currentRow,"TABLE");
 for(var i=selRows.length;i>0;i–){
  if(selRows[i-1].rowIndex < currentTable.rows.length-1){
   var swapped = selRows[i-1].swapNode(currentTable.rows[selRows[i-1].rowIndex+1]);
  }
 }
 for(var i=0;i<selCheck.length;i++){
  selCheck[i].checked = true;
 }
</script>
<script language="javascript1.2" for="checkAllButton" event="onclick">
 var allCheckbox = window.getCustomCheckbox("FORM1");
 if(this.innerHTML=="全选"){
  for(var i=0;i<allCheckbox.length;i++){
   allCheckbox[i].checked = true;
  }
  this.innerHTML = "取消";
 }else{
  for(var i=0;i<allCheckbox.length;i++){
   allCheckbox[i].checked = false;
  }
  this.innerHTML = "全选"; 
 }
</script>
<script language="javascript1.2" for="delButton" event="onclick">
  var allCheckbox = window.getCustomCheckbox("FORM1");
  if(!window.confirm("确认要删除吗?")) return false;
  for(var i=0;i<allCheckbox.length;i++){
   if(allCheckbox[i].checked==true){
    var currentRow = getParentNode(allCheckbox[i],"TR");
    var currentTable = getParentNode(currentRow,"TABLE");
    currentTable.deleteRow(currentRow.rowIndex);
   }
  }
</script>
<script language="javascript1.2">
 function getParentNode(objHtml,tagName){
  var parentNode = objHtml.parentNode;
  while(parentNode.tagName!=tagName){
   parentNode = parentNode.parentNode;
  }
  return parentNode;
 }
 window.getCustomCheckbox = function(strFormName){
  var allCheckbox = new Array();
  var allInput = document.forms[strFormName].tags("INPUT");
  for(var i=0;i<allInput.length;i++){
   if(allInput[i].type=="checkbox"&&allInput[i].id.substring(0,3)=="chb"){
    allCheckbox[allCheckbox.length] = allInput[i];
   }
  }
  return allCheckbox;
 }
</script>
</HEAD>
<BODY>
<xml id="xmlData">
<?xml version="1.0" encoding="gb2312" ?>
 <datas>
  <dataRow>
   <id>1</id>
   <check></check>
   <name>Iori</name>
   <alias>Yagami</alias>
  </dataRow>
  <dataRow>
   <id>2</id>
   <check></check>
   <name>Athena</name>
   <alias>Asamiya</alias>
  </dataRow>
  <dataRow>
   <id>3</id>
   <check></check>
   <name>Kyo</name>
   <alias>Kusanag</alias>
  </dataRow>
  <dataRow>
   <id>4</id>
   <check></check>
   <name>Mai</name>
   <alias>Shiranui</alias>
  </dataRow>
  <dataRow>
   <id>5</id>
   <check></check>
   <name>Kasumi</name>
   <alias>Todo</alias>
  </dataRow>
 </datas>
</xml>
<table bgcolor="menu" border="1" datasrc="#xmlData">
 <thead>
  <th>ID</th>
  <th>状态</th>
  <th>菜单</th>
  <th>别名</th>
 </thead>
 <tbody>
 <tr>
  <td><span dataFld="id"></span></td>
  <td><input type="checkbox" name="chb_Control"/></td>
  <td><span dataFld="name"></span></td>
  <td><span dataFld="alias"></span></td>
 </tr>
 </tbody>
</table>
<br/>
<FORM NAME="FORM1" METHOD="POST">
<table bgcolor="menu" border="1">
 <thead>
  <th>ID</th>
  <th>状态</th>
  <th>菜单</th>
  <th>别名</th>
 </thead>
 <tbody>
 <tr>
  <td>01</td>
  <td align="center"><input type="checkbox" id="chb_01"/></td>
  <td><label for="chb_01">Iori</label></td>
  <td>i</td>
 </tr>
 <tr>
  <td>02</td>
  <td align="center"><input type="checkbox" id="chb_02"/></td>
  <td><label for="chb_02">Terry</label></td>
  <td>t</td>
 </tr>
 <tr>
  <td>03</td>
  <td align="center"><input type="checkbox" id="chb_03"/></td>
  <td><label for="chb_03">Anndy</label></td>
  <td>a</td>
 </tr>
 <tr>
  <td>04</td>
  <td align="center"><input type="checkbox" id="chb_04"/></td>
  <td><label for="chb_03">Jonny</label></td>
  <td>a</td>
 </tr>
 </tbody>
</table>
<hr>
<button style="width=35" id="checkAllButton">全选</button>
<button style="width=30" id="orderUpButton"> ↑ </button>
<button style="width=30" id="orderDownButton"> ↓ </button>
<button style="width=35" id="delButton"> 删除 </button>
</FORM>
</BODY>
</HTML>
posted on 2023-06-25 16:02  不及格的程序员-八神  阅读(2)  评论(0编辑  收藏  举报