大虾~!ASP后台如何取JS值
本帖最后由 renze 于 2013-09-10 18:23:14 编辑 <script>
var id = 1 ;
function addInput(){
//设置id的生成规则 假如 每次是++1
var form = document.getElementById("formD");
var input = document.createElement("input");
input.id=id+"_input" ;
input.type = "text" ;
form.appendChild(input);
var html = form.innerHTML ;
html += "<button id='"+id+"_button' onclick='delInput("+id+")' >删除</button><br id='"+id+"_br' />" ;
form.innerHTML = html ;
id += 1 ;//完成添加后 给id++1
}
function delInput(id){
var form = document.getElementById("formD");
var input = document.getElementById(id+"_input");
var button = document.getElementById(id+"_button");
var br = document.getElementById(id+"_br");
form.removeChild(input);
form.removeChild(button);
form.removeChild(br);
}
</script>
<button onclick="addInput();" >新增输入框</button>
<form id="formD" >ddd<input type="submit" value="提交" name="B1"></form>
小弟ASP不熟,请大虾写帮忙写完整处理程序 动态INPUT?ASP js asp 动态INPUT
[解决办法]
<% dim rs,sql,inputNameArray
if inputName<>"" then
set rs=server.CreateObject ("ADODB.RecordSet")
sql="select * from 表"
rs.open sql,conn,3,3
inputNameArray=split(inputName,",")
for i = 0 to ubound(inputNameArray)
rs.addnew
rs("inputID")=inputId
rs("inputName")=inputNameArray(i)
rs.update
next
rs.close
set rs=nothing
end if
%>
[解决办法]
<script>
function aa(sel){
var n = sel.options[sel.selectedIndex].value;
hf.location.href= "test1.asp?n=" + escape(n) + "&" + escape(new Date())
}
</script>
<select name="SmallClassName" onchange="aa(this)">
<option value="9">哈哈</option>
<option value="2">哈哈</option>
</select>
<div id="pad"></div>
<iframe name="hf" style="display:none"></iframe>
<%
s_id = Trim(Request("n"))
'查数据库略
SQL="select * from KS_smallclass where id=" & s_id
'rs.open sql, conn,1,1
s = ""
For i = 1 To s_id
s = s & "<input name='cailiao1' type='file' id='cailiao1' />"
Next
s = Replace(s, """","\""")
%>
<script>
window.onload=function(){
parent.document.getElementById("pad").innerHTML = "<%=s%>";
location.replace("about:blank")
}
</script>