文本框显示问题?

cpzhg 2004-04-16 12:54:13
如何根据下拉列表框中选中的值进行显示<tr>中的文本框,<tr>里包括多个文本框。例如我选择下拉列表中的1就显示1个<tr>,选择2就显示2个<tr>
...全文
31 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
zmhqyw 2004-04-27
  • 打赏
  • 举报
回复
up

<script language="vbscript">
sub settable(para)
str="<table width=100% border=1>"
for i=1 to para

str=str & "<tr><td><input type=text name=textfield></td></tr>"

next
str=str & "</table>"
document.all.mytd.innerHTML=str
end sub
</script>
</head>

<body>
<select name="sele" id="sele" onChange="vbscript:settable sele.value" >
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
<table width="31%" height="204" border="1" id="mytable">
<tr><td id="mytd"> </td></tr>
</table>
</body>
cpzhg 2004-04-16
  • 打赏
  • 举报
回复
to littleboys(飞龙)

我的输入框是固定死的,不需要增加,只需要增加行数就行了
littleboys 2004-04-16
  • 打赏
  • 举报
回复
我给你改一下。
<script language="vbscript">
sub settable(para)
str="<table width=100% border=1><tr><td>"
for i=1 to para
str=str & "<input type='text' name='name"&i&"'>"
next
str=str & "</td></tr></table>"
document.all.mytd.innerHTML=str
end sub
</script>
</head>

<body>
<select name="sele" id="sele" onChange="vbscript:settable sele.value" >
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
<table width="31%" height="204" border="1" id="mytable">
<tr><td id="mytd"> </td></tr>
</table>
</body>
cpzhg 2004-04-16
  • 打赏
  • 举报
回复
up
cpzhg 2004-04-16
  • 打赏
  • 举报
回复
to zmhqyw(炎舞)
我想用输入框替换掉123,怎么不行呀
wanghr100 2004-04-16
  • 打赏
  • 举报
回复
<select onchange="addtr(this.value)">
<option value="1">1
<option value="2">2
<option value="3">3
</select>
<table id=tab></table>
<script language=javascript>
function addtr(n)
{
for(var i=0;i<n;i++)
{
newRow=tab.insertRow()
newCell=newRow.insertCell()
newCell.innerHTML="<input style='width:100' type=text>"
}
}
</script>
zmhqyw 2004-04-16
  • 打赏
  • 举报
回复
你要这种垃圾代码做什么用啊?
zmhqyw 2004-04-16
  • 打赏
  • 举报
回复
<script language="vbscript">
sub settable(para)
str="<table width=100% border=1>"
for i=1 to para
str=str & "<tr><td>123</td></tr>"
next
str=str & "</table>"
document.all.mytd.innerHTML=str
end sub
</script>
</head>

<body>
<select name="sele" id="sele" onChange="vbscript:settable sele.value" >
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
<table width="31%" height="204" border="1" id="mytable">
<tr><td id="mytd"> </td></tr>
</table>
</body>
cpzhg 2004-04-16
  • 打赏
  • 举报
回复
自己up
cpzhg 2004-04-16
  • 打赏
  • 举报
回复
怎么没人回答呀

87,904

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧