|
<%
Sub ShowButton(i)
Response.Write("<td>")
Response.Write("<input type='button'")
Response.Write(" name='edit"& i &"'") '这地方中间的空格去掉
Response.Write(" value='编辑'")
Response.Write(" onclick='doedit(" & i & ")'>")
Response.Write(" ")
Response.Write("<input type='button'")
Response.Write(" name='del" & i & "'")
Response.Write(" value='删除'")
Response.Write(" onclick='dodel(" & i & ")'>")
Response.Write("</td>")
End Sub
' 注释:定义过程用于生成文本框控件
Sub ShowTextBox(idname, i, tbsize, tbmaxlen, tbvalue)
Response.Write("<td><input type='text'")
Response.Write(" name='" & idname & i & "'")
Response.Write(" size='" & tbsize & "'")
Response.Write(" maxlength='" & tbmaxlen & "'")
Response.Write(" value='" & tbvalue & "'")
Response.Write(" style='border:none'")
Response.Write(" readonly></td>")
End Sub
%>
<script language="vbscript">
Sub doedit(i)
Dim edid, dlid,btitle
'' 注释:生成当前记录行中的控件对象名称
edid = "edit" & i : dlid = "del" & i : btitle="btitle" & i
'' 注释:根据按钮的标题文本内容来执行相应操作
If document.all(edid).value = "编辑" Then '' 将记录行设置为编辑状态
'' 注释:修改按钮的提示标题
document.all(edid).value = "确定"
document.all(dlid).value = "取消"
'' 注释:将输入焦点移到标题文本框
document.all(btitle).focus
''用表单名加表单元素名时,中间的表单元素名就不能用变量代替,为什么我也说不清,只是没次用都回出现这样的情况!
End if
End Sub
</script>
<form name="fset1" >
<%
CAll ShowTextBox("btitle","1",8,5,"2")
Call ShowButton("1")
''这里我给换成可固定值,因为不知道LZ的bid1函数是怎么写的!
%>
</form> |
|