大家看看这个代码,怎么可以获得数组的值,存成字符串呢? var tt = new Array(){1,2,3};var str = tt.join("|"); 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <form action="" method="post" onsubmit="mm();">JS:function mm(){ var a = document.getElementsByName("tt[]"); var s = ""; for(var i=0; i<a.length; i++) s += "|"+ a[i].value; document.all.paths.value = s.substr(1);} <script>var count=1;function addline(content){newline=document.all.test.insertRow();newline.insertCell().innerHTML='<input type="text" name=tt'+count+'><input type="button" value="删除" onclick="del('+count+')">'count=count+1;form1.ct.value=count;}function del(id){document.all.test.deleteRow(window.event.srcElement.parentElement.parentElement.rowIndex);count=count-1;form1.ct.value=count;}</script><form name=form1 action="" method="post"><table border="0" id="test" style="BORDER-COLLAPSE: collapse" bordercolor="#111111" cellpadding="0"cellspacing="0"><tr><td colspan="2"><input type="text" name="tt0" size="20"></td></tr></table><INPUT id="ct" name="ct" size="28"><input type="button" onclick="addline()" value="增加"><input type="submit" value="取值"> </form>给每一个input一个唯一的id,并记录总的count,在响应的时候一个一个取。 分数有点少了啊,用了好长时间。 楼上的不行啊, meizz(梅花雪) 的可以了<META http-equiv="Content-Type" content="text/html; charset=gb2312"><form><table border="0" id="test" style="BORDER-COLLAPSE: collapse" bordercolor="#111111" cellpadding="0"cellspacing="0"><tr><td colspan="2"><input type="text" name="tt[]" size="20"> <input type="button" onclick="addline()" value="增加"></td></tr></table><input type="button" value="取值" onclick="mm();"> <INPUT id="paths" name="paths" size="28"></form><script>function addline(content){newline=document.all.test.insertRow();newline.insertCell().innerHTML='<input type="text" name="tt[]"><input type="button" value="删除" onclick="del()">'}function del(){document.all.test.deleteRow(window.event.srcElement.parentElement.parentElement.rowIndex);}function mm(){ var a = document.getElementsByName("tt[]"); var s = ""; for(var i=0; i<a.length; i++) s += "|"+ a[i].value; document.all.paths.value = s.substr(1);}</script> js问题求高人解答。 javascript 获取多选框的值 在table中的控件一些属性如何读出, 一个onload事件的问题 两个下拉框的的联动 【梅花雪网页脚本控件集】MzTreeView 1.0 一次加载数据的树 关于在windows2003中iis6和Createobject的问题。 用javascript在一个路径里面取一个文件名怎么取。。。 关于浮动div居中的问题!急..... 在javascript中怎么将前后两个日期的天数差为除开了星期6,7的? 有很少遇到的问题,不知咋解决? js如何在页面上调用window的字体对话框,
function mm()
{
var a = document.getElementsByName("tt[]");
var s = "";
for(var i=0; i<a.length; i++) s += "|"+ a[i].value;
document.all.paths.value = s.substr(1);
}
var count=1;
function addline(content){
newline=document.all.test.insertRow();
newline.insertCell().innerHTML='<input type="text" name=tt'+count+'><input type="button" value="删除" onclick="del('+count+')">'
count=count+1;
form1.ct.value=count;
}
function del(id){
document.all.test.deleteRow(window.event.srcElement.parentElement.parentElement.rowIndex);
count=count-1;
form1.ct.value=count;
}
</script>
<form name=form1 action="" method="post">
<table border="0" id="test" style="BORDER-COLLAPSE: collapse" bordercolor="#111111" cellpadding="0"
cellspacing="0">
<tr>
<td colspan="2"><input type="text" name="tt0" size="20"></td>
</tr>
</table>
<INPUT id="ct" name="ct" size="28">
<input type="button" onclick="addline()" value="增加">
<input type="submit" value="取值">
</form>给每一个input一个唯一的id,并记录总的count,在响应的时候一个一个取。
分数有点少了啊,用了好长时间。
<META http-equiv="Content-Type" content="text/html; charset=gb2312">
<form>
<table border="0" id="test" style="BORDER-COLLAPSE: collapse" bordercolor="#111111" cellpadding="0"
cellspacing="0">
<tr>
<td colspan="2"><input type="text" name="tt[]" size="20"> <input type="button" onclick="addline()" value="增加"></td>
</tr>
</table>
<input type="button" value="取值" onclick="mm();"> <INPUT id="paths" name="paths" size="28">
</form>
<script>
function addline(content){
newline=document.all.test.insertRow();
newline.insertCell().innerHTML='<input type="text" name="tt[]"><input type="button" value="删除" onclick="del()">'}
function del(){
document.all.test.deleteRow(window.event.srcElement.parentElement.parentElement.rowIndex);
}function mm()
{
var a = document.getElementsByName("tt[]");
var s = "";
for(var i=0; i<a.length; i++) s += "|"+ a[i].value;
document.all.paths.value = s.substr(1);
}</script>