关于表格

我又一个2行的表格,在第二行有一格按钮叫修改,点击后自动生成第三行表格,并且在其中放入一个文本框,里面写入“abc”,在文本框的右边有一个按钮叫确认修改
,点击后让str="abc",同时表格又变成2行开始时的样子,这个效果怎么做?急
---------------------------------------------------------------

我只给你思路了

 1<table border="1" width="100">
 2<tr>
 3<td width="100%">test</td>
 4</tr>
 5<tr>
 6<td width="100%"><span id="a">a</span><input onclick="test.style.display=test.style.display==''?'none':''" type="button" value="修改"/></td>
 7</tr>
 8<tr id="test" style="display:none">
 9<td width="100%"><input name="abc" value="abc"/><input onclick="a.innerText=abc.value;test.style.display='none';abc.value=''" type="button" value="确认修改"/></td>
10</tr>
11</table>

要改变str,要提交
---------------------------------------------------------------

1<table border="1">
2<tr><td>aa</td></tr>
3<tr><td><input onclick="tr1.style.display=(tr1.style.display=='none')?'':'none';" type="button" value="modify"/></td></tr>
4<tr id="tr1" style="display:none"><td><input name="strValue" type="text" value="abc"/><input onclick="str=strValue.value;tr1.style.display='none';" type="button" value="Set"/></td></tr>
5</table>
1<input onclick="alert(str)" type="button" value="get Str Value"/>

---------------------------------------------------------------

大概实现了你要的功能,只需要修改修改就行了

 1<html>
 2<script language="vbscript">   
 3  
 4function b1_OnClick ()   
 5t1.style.display = block   
 6b2.style.display = block   
 7end function   
 8  
 9function b2_OnClick ()   
10t1.style.display =none   
11b2.style.display = none   
12t2.value = t1.value   
13end function   
14</script>
15<body>
16<p>
17<input id="t2" name="t2"/>
18<input id="b1" name="button1" style="WIDTH: 58px; HEIGHT: 23px" type="button" value="修改"/></p>
19<p>
20<input id="t1" name="text1" style="DISPLAY: none"/>
21<input id="b2" name="button2" style="DISPLAY: none" type="button" value="确认修改"/></p>
22</body>
23</html>
Published At
Categories with Web编程
Tagged with
comments powered by Disqus