asp取動態表單中資料並寫入xml檔案,用xsl顯示

來源:互聯網
上載者:User
xml|動態|資料|顯示|xml  

1.動態表單的介面,從csdn論壇上參考

<html>
<head>
<title>無標題文檔</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language="javascript">
var curRow=null;
var y=1;

function selectRow(){
var e=window.event;
var tr1=e.srcElement;
if(curRow)
curRow.bgColor="#FFFFFF";
tr1.bgColor="e7e7e7";
curRow=tr1;
}
function addRow(src){
//alert(src);
var newrow = src.insertRow(src.rows.length-1);
newrow.attachEvent("onclick",selectRow);
newrow.height=20;
var i=4;

while(i--){
var newcell = newrow.insertCell();

switch(i){
case 0: newcell.innerHTML= '<input type="button" value="刪除此行">'+(y++);
document.all.count.value=y-1;
break;
case 1:newcell.innerHTML=div2.innerHTML;break;
case 2:newcell.innerHTML=div3.innerHTML;break;
case 3:newcell.innerHTML=div4.innerHTML;break;
default: newcell.innerHTML=div1.innerHTML;break;

}
}
//alert(newrow.outerHTML);
}

function delRow(src){

var tab=src.parentElement;
var i=tab.rows.length;
var j=tab.rows.length;
while(i--){
if(src==tab.rows[i]){
//alert("就是這行----"+ i);
document.all.count.value=j-3;
tab.deleteRow(i);

}

}
}
</script>
</head>

<body>
<form name="form1" action="2.asp" method="post" onsubmit=return(checkv())>
<h3>請輸入經銷商的通訊資訊:</h3>
姓  名: <input type="text"  name="jxname"><br>
地  址: <input type="text"  name="jxadd"><br>
電  話: <input type="text"  name="jxtel"><br>
請輸入庫存資訊<br>
<table id="tb" width="100%"  border="1" align="center" cellpadding="1" cellspacing="1" style="border-collapse:collapse" bordercolor="#111111">
  <tr>
    <th scope="col" width="25%">品名</th>
    <th scope="col" width="25%">規格</th>
    <th scope="col" width="25%">庫存量</th>
    <th scope="col" width="25%">操作</th>
  </tr>
  <tr id="blankRow" >
    <td> </td>
    <td> </td>
    <td> </td>
    <td> </td>
  </tr>
</table>
<input type="hidden" name="count" value="count">
<input type="submit" id="btnSub" name="btnSub" value="提交"><br>
</form>
<div id="div1" style="display:none "><input id="txt" type="text" name="id" style="width:97%; background-color:#FFFFEF"></div>

<div id="div2" style="display:none "><input id="txt" type="text" name="id1" style="width:97%; background-color:#FFFFEF" value="11"></div>
</body>
<div id="div3" style="display:none "><select  name="id2" style="width:97%; background-color:#FFFFEF" >
<option value="箱">箱</option>
<option value="件">件</option>
       
        </select></div>
<div id="div4" style="display:none "><input id="txt" type="text" name="id3" style="width:97%; background-color:#FFFFEF" value="33"></div>
<script language="javascript">
function checkv()
{

if (form1.jxname.value.length == 0)
   {     
    alert("請填寫姓名和地址!");
    form1.jxname.focus();
 return false;
      }

else if(!(check_number(form1.id1.value)))
  {
   alert("數量只能為數字")
form1.id1.focus();
return false;
}
else
return (true);
}
function check_number(myint)
{

  var checkOK = "0123456789";
  var checkStr = myint;
  var allValid = true;
  var decPoints = 0;
  var allNum = "";
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
    allNum += ch;
  }
  if (!allValid)
  {
    return (false);
  }
 return (true);
 }



相關文章

Beyond APAC's No.1 Cloud

19.6% IaaS Market Share in Asia Pacific - Gartner IT Service report, 2018

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。