表单input.htm <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>欢迎使用学生管理系统</title> <style type="text/css"> <!-- .style5 {font-family: "楷体_GB2312"; font-size: 16px; } --> </style> <script language="javascript" > function ShowImg(src) { document.all("imgDiv").innerHTML="<img id=\'imgObj\' onerror=\'JavaScript:GetError()\' width=\'90\' height=\'120\' onload=\'JavaScript:GetSize()\' src=\'" + src + "\'>"; } </script> </head>
<body leftmargin="0" topmargin="0"> <form name="form1" method="post" action="submit.asp" enctype = "multipart/form-data"> <table width="700" height="351" border="0" cellpadding="0" cellspacing="0"> <tr> <td height="25" bgcolor="#6699FF"> </td> <td colspan="2" bgcolor="#6699FF"> </td> <td bgcolor="#6699FF"> </td> </tr> <tr> <td width="97" height="32" bgcolor="#6699FF"><div align="right"><span class="style5">学 号:</span></div></td> <td bgcolor="#99CCFF"> <div align="left"> <input name="txtid" type="text" id="txtid"> </div></td> <td bgcolor="#99CCFF"><span class="style5">照 片:</span></td> <td width="85" bgcolor="#6699FF"> </td> </tr> <tr> <td height="32" bgcolor="#6699FF"><div align="right"><span class="style5">姓 名:</span></div></td> <td width="227" bgcolor="#99CCFF" align="left"> <input name="txtxm" type="text" id="txtxm"> </td> <td width="275" rowspan="3" bgcolor="#99CCFF"><div id="imgDiv"> </div></td> <td bgcolor="#6699FF"> </td> </tr> <tr> <td height="32" bgcolor="#6699FF"><div align="right"><span class="style5">性 别:</span></div></td> <td bgcolor="#99CCFF" align="left"> <div align="left"><span class="style5">男</span><input type="radio" name="txtxb" value="男"> <span class="style5">女</span> <input type="radio" name="txtxb" value="女"> </div> </td> <td bgcolor="#6699FF"> </td> </tr> <tr> <td height="32" bgcolor="#6699FF"><div align="right"><span class="style5">出生日期:</span></div></td> <td bgcolor="#99CCFF" align="left"> <input name="txtcsrj" type="text" id="txtcsrj"> </td> <td bgcolor="#6699FF"> </td> </tr> <tr> <td height="32" bgcolor="#6699FF"><div align="right"><span class="style5">入学成绩:</span></div></td> <td bgcolor="#99CCFF" align="left"> <input name="txtrxcj" type="text" id="txtrxcj"></td> <td bgcolor="#99CCFF" align="left"><input type="file" name="upfile" onKeyDown="JavaScript:return(false);" onpropertychange="JavaScript:ShowImg(this.value);" class="style5"></td> <td bgcolor="#6699FF"> </td> </tr> <tr> <td height="32" bgcolor="#6699FF"><div align="right"><span class="style5">班 级:</span></div></td> <td colspan="2" bgcolor="#99CCFF"> <input name="txtbj" type="text" id="txtbj" align="left"> </td> <td bgcolor="#6699FF"> </td> </tr> <tr> <td height="32" bgcolor="#6699FF"><div align="right"><span class="style5">住校否:</span></div></td> <td colspan="2" bgcolor="#99CCFF" align="left"> <input name="txtzxf" type="text" id="txtzxf"> </td> <td bgcolor="#6699FF"> </td> </tr> <tr> <td bgcolor="#6699FF"><div align="right"><span class="style5">奖 惩:</span></div></td> <td colspan="2" bgcolor="#99CCFF" align="left"> <textarea name="txtjc" cols="40" rows="5" wrap="PHYSICAL" id="txtjc"></textarea> </form></td> <td bgcolor="#6699FF"> </td> </tr> <tr> <td height="27" bgcolor="#6699FF"> </td> <td colspan="2" bgcolor="#6699FF" align="center"><input type="submit" value="保存"> <input type="reset" value="重填"></td> <td bgcolor="#6699FF"> </td> </tr> </table> </body> </html> 提交程序submit.asp <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>欢迎使用学生管理系统</title> </head> <body> <% on error resume next dim rs dim formsize,formdata,bncrlf,divider,datastart,dataend,mydata dim xh, xm, xb,csrj,rxcj,bj,zxf,jc,itime if request("action") = "new" then response.buffer=true formsize=request.totalbytes '取得客户端发过来的大小 formdata=request.binaryread(formsize)'把客户发过来的数据转成二进制作 bncrlf=chrB(13) & chrB(10) divider=leftB(formdata,clng(instrb(formdata,bncrlf))-1) datastart=instrb(formdata,bncrlf & bncrlf)+4 dataend=instrb(datastart+1,formdata,divider)-datastart mydata=midb(formdata,datastart,dataend)'上面总共是取得图片的二进制数据 xh = inohtml(trim(request("txtid"))) xm = inohtml(trim(request("txtxm"))) xb = inohtml(trim(request("txtxb"))) csrj = inohtml(trim(request("txtcsrj"))) rxcj = inohtml(trim(request("txtrxcj"))) bj = inohtml(trim(request("txtbj"))) zxf = inohtml(trim(request("txtzxf"))) jc = request("txtjc") itime = now() if xh="" then %> <!--#include file="reinput.asp"--> <% else %> <!--#include file="conn.asp"--> <% sql = "select * from xsgl" set rs = server.createobject("adodb.recordset") rs.open sql, conn, 1, 3 rs.addnew rs("x_h") = xh rs("x_m") = xm rs("x_b") = xb rs("csrj") = csrj rs("rxcj") = rxcj rs("b_j") = bj rs("zx_f") = zxf rx("j_c") = jc rs("ftime") = itime rs("z_p").AppendChunk myData rs.update rs.close set rs = nothing conn.close set conn=nothing if err.number = 0 then response.write("保存成功^_^") response.redirect ("input.asp") end if end if end if %> </body> </html> 都不能提交,总显示缺少对象 麻烦了各位
[此贴子已经被hxfly于2005-5-27 17:05:23编辑过]