ASP之處理用Javascript動(dòng)態(tài)添加的表單元素?cái)?shù)據(jù)的代碼
更新時(shí)間:2007年11月24日 12:27:52 作者:
上一篇文章講到了動(dòng)態(tài)添加表單元素,這次我們來講講怎么樣來處理這些動(dòng)態(tài)添加的表單元素傳過來的數(shù)據(jù)! 怎么樣動(dòng)態(tài)添加表單元素,我這里就不細(xì)說了!不明白的看看上一篇文章http://www.dbjr.com.cn/html/200711/23/12856.htm下面是動(dòng)態(tài)添加表單元素的頁面代碼!
<html >
<head>
<title>動(dòng)態(tài)添加表單元素BlueShine</title>
</head>
<script language="javascript">
function AddElement(mytype){
var mytype,TemO=document.getElementById("add");
var newInput = document.createElement("input");
newInput.type=mytype;
newInput.name="input1";//這個(gè)是必須的,在處理頁中要用到!
TemO.appendChild(newInput);
var newline= document.createElement("br");
TemO.appendChild(newline);
}
</script>
<body>
<form action="getdata.asp" method="post" name="frm">
<p style=" background:#FFEC8B;border:solid 1px #1E90FF;font-size:13px;line-height:200%;width:100px;text-align:center"><a style="color:#218868;" href="javascript:void(0)" onClick="AddElement('text')">添加文本框</a></p>
<p id="add"></p>
<label>
<input type="submit" name="Submit" value="提交">
</label>
<label>
<input type="reset" name="Submit2" value="重置">
</label>
</form>
</body>
</html>
下面是數(shù)據(jù)處理頁面代碼:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!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=gb2312" />
<title>動(dòng)態(tài)添加表單元素</title>
</head>
<body>
<div style="font-size:13px"><%
dim data,arr,n
data=Trim(Request.Form("input1"))'這就是在代碼中定義的name屬性
arr=split(data,",")'用Split函數(shù)對(duì)數(shù)據(jù)進(jìn)行分割!
Response.Write("這是未分割的數(shù)據(jù):")
Response.Write(data)
Response.Write("<br>")
Response.Write("<br>")
Response.Write("這是用Split函數(shù)分割后的數(shù)據(jù):")
Response.Write("<br>")
for n= 0 to ubound(arr)
Response.Write(arr(n))
Response.Write("<br>")
Next
%></div>
</body>
</html>
復(fù)制代碼 代碼如下:
<html >
<head>
<title>動(dòng)態(tài)添加表單元素BlueShine</title>
</head>
<script language="javascript">
function AddElement(mytype){
var mytype,TemO=document.getElementById("add");
var newInput = document.createElement("input");
newInput.type=mytype;
newInput.name="input1";//這個(gè)是必須的,在處理頁中要用到!
TemO.appendChild(newInput);
var newline= document.createElement("br");
TemO.appendChild(newline);
}
</script>
<body>
<form action="getdata.asp" method="post" name="frm">
<p style=" background:#FFEC8B;border:solid 1px #1E90FF;font-size:13px;line-height:200%;width:100px;text-align:center"><a style="color:#218868;" href="javascript:void(0)" onClick="AddElement('text')">添加文本框</a></p>
<p id="add"></p>
<label>
<input type="submit" name="Submit" value="提交">
</label>
<label>
<input type="reset" name="Submit2" value="重置">
</label>
</form>
</body>
</html>
下面是數(shù)據(jù)處理頁面代碼:
復(fù)制代碼 代碼如下:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!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=gb2312" />
<title>動(dòng)態(tài)添加表單元素</title>
</head>
<body>
<div style="font-size:13px"><%
dim data,arr,n
data=Trim(Request.Form("input1"))'這就是在代碼中定義的name屬性
arr=split(data,",")'用Split函數(shù)對(duì)數(shù)據(jù)進(jìn)行分割!
Response.Write("這是未分割的數(shù)據(jù):")
Response.Write(data)
Response.Write("<br>")
Response.Write("<br>")
Response.Write("這是用Split函數(shù)分割后的數(shù)據(jù):")
Response.Write("<br>")
for n= 0 to ubound(arr)
Response.Write(arr(n))
Response.Write("<br>")
Next
%></div>
</body>
</html>
您可能感興趣的文章:
- 原生js實(shí)現(xiàn)獲取form表單數(shù)據(jù)代碼實(shí)例
- Vue.js實(shí)現(xiàn)雙向數(shù)據(jù)綁定方法(表單自動(dòng)賦值、表單自動(dòng)取值)
- form表單數(shù)據(jù)封裝成json格式并提交給服務(wù)器的實(shí)現(xiàn)方法
- JS獲取一個(gè)表單字段中多條數(shù)據(jù)并轉(zhuǎn)化為json格式
- 基于JavaScript實(shí)現(xiàn)帶數(shù)據(jù)驗(yàn)證和復(fù)選框的表單提交
- Vue.js基礎(chǔ)指令實(shí)例講解(各種數(shù)據(jù)綁定、表單渲染大總結(jié))
- 利用JS輕松實(shí)現(xiàn)獲取表單數(shù)據(jù)
- JavaScript動(dòng)態(tài)添加數(shù)據(jù)到表單并提交的幾種方式
相關(guān)文章
使用Flash DownLoad編寫采集器(之突破防盜連下載音樂文件)
使用Flash DownLoad編寫采集器(之突破防盜連下載音樂文件)...2007-02-02asp中使用MSXML2.ServerXMLHTTP實(shí)現(xiàn)異步請求例子
這篇文章主要介紹了asp中使用MSXML2.ServerXMLHTTP實(shí)現(xiàn)異步請求例子,本文還給出了MSXML2.ServerXMLHTTP異步請求代碼編寫最常犯的錯(cuò)誤,需要的朋友可以參考下2014-08-08ASP運(yùn)行在IIS6 500錯(cuò)誤解決辦法
近日用ASP開發(fā)了一個(gè)進(jìn)銷存系統(tǒng)(開發(fā)環(huán)境:Windows2000+DW MX 2004+IIS 5.0),在本機(jī)上運(yùn)行、調(diào)試一切正常,沒有任何錯(cuò)誤信息,但將它放到windows server 2003上去就不行了2008-10-10ASP Cookies操作的詳細(xì)介紹與實(shí)例代碼
Request和Response對(duì)象都有一組Cookie。Request.cookie集合是一系列Cookie,從客戶端與HTTP Request一起發(fā)送到Web服務(wù)器。反過來,如果你希望把Cookie發(fā)送到客戶機(jī),就可以使用Response.cookie。2010-03-03asp去除html的函數(shù)代碼分析附實(shí)例說明
asp去除html的函數(shù)代碼分析附實(shí)例說明,經(jīng)腳本之家編程測試確實(shí)好用。2012-01-01