您现在的位置: 军旅同心 >> 读书赏析 >> 学习园地 >> 电脑网络 >> 技术文章 >> 文章正文
如何使用JSP+MySQL创建留言本(三)
作者:采集员 文章来源:来源于网络 点击数: 更新时间:2005-9-10 14:28:17
0%"><br>
    &nbsp;&nbsp;&nbsp;&nbsp;-</font><%=time %><font style="COLOR: green; LINE-HEIGHT: 150%">(来自</font><%=ip %><font style="COLOR: green; LINE-HEIGHT: 150%">)</font></td>
  </tr>
</tbody>
</table>
<hr color="#0080c0" noshade size="1" width="100%">

<%
} catch (SQLException e) //写数据库失败
{ out.print ("<font color=red>留言失败</font>");
  out.print (MyQuery);
  out.print (userid);
}
else
{
  out.print ("<font color=red>总共有"+testcomment.ErrorCount+"条错误数据,请修改!</font>");
%>

<script language="JavaScript">
<!--
function test_comments(theForm)
{
if (theForm.name.value == "")
{    alert("姓名不能为空!:-)");
  theForm.name.focus();
  return (false);
}
if (theForm.name.value.length > 12)
{ alert("姓名太长,不能多于12个字符(既六个汉字)!");
  theForm.name.focus();
  return (false);
}

if (theForm.address.value.length > 40)
{ alert("地址太长,不能多于40个字符(20个汉字)!");
  theForm.name.focus();
  return (false);
}

if (theForm.comment.value == "")
{ alert("抱歉,留言不能为空!你必须输入留言");
  theForm.comment.focus();
  return (false);
}
if (theForm.comment.value.length > 1000)
{ alert("抱歉,你的留言太长,最多为1000个字符!");
  theForm.comment.focus();
  return (false);
}
return (true);
} -->
<table>
<tr>
  <td>
   <table cellspacing="0" cellpadding="0">
    <tr>
     <td><!--表单开始-->
      <form action="addmysql.jsp" method="POST" name="all_comments" onsubmit="javascript:return (test_comments(this))">
       <table border="0" width="100%" cellspacing="0" cellpadding="0">
        <tr>
         <td width="60%">昵&nbsp;称:<input name="name" size="20" value="<%if (username != null) out.print (username);%>"><%=testcomment.Comment_Er("username")%></td>
         <td nowrap width="40%">性&nbsp;别:<select name="sex" size="1">
           <option selected value="男" <%if(sex=="男") out.print ("select"); %>>男</option>
           <option value="女" <%if(sex=="女") out.print ("select"); %>>女</option>
           <option value="保密" <%if(sex=="保密") out.print ("select"); %>>保密</option>
          </select><%=testcomment.Comment_Er("sex")%></td>
        </tr>
        <tr>
         <td colspan="2">地&nbsp;址:<input name="address" size="40" value="<%if (address!=null) out.print(address);%>"><%=testcomment.Comment_Er("address")%></td>
        </tr>
        <tr>
         <td>电&nbsp;话:<input name="telphone" size="15" value="<%if(telnumber!=null)out.print(telnumber);%>"><%=testcomment.Comment_Er("tel")%></td>
         <td>邮&nbsp;编:<input name="postal" size="6" value="<%if(post!=null) out.print(post);%>"><%=testcomment.Comment_Er("postal")%></td>
        </tr>
        <tr>
         <td>&nbsp;OICQ:<input name="oicq" size="10" value="<%if(oicq!=null) out.print (oicq);%>"><%=testcomment.Comment_Er("oicq")%></td>
         <td>&nbsp;ICQ&nbsp;:<input name="icq" size="15" value="<%if(icq!=null)out.print(icq);%>"><%=testcomment.Comment_Er("icq")%></td>
        </tr>
        <tr>
         <td colspan="2">Email:<input name="email" size="25" value="<%if(email!=null) out.print(email);%>"><%//=testcomment.Comment_Er("")%></td>
        </tr>
        <tr>
         <td colspan="2">网&nbsp;址:<input name="url" size="40" value="<%if(url!=null)out.print(url);%>"><%//=testcomment.Comment_Er("")%></td>
        </tr>
        <tr>
         <td colspan="2"><textarea cols="80" name="comment" rows="10" wrap="physical"><%if (comment!=null)out.print (comment);%></textarea>
        <tr>
         <td align="right"><input name="put_submit" type="submit" value="确定" ?></td>
         <td align="left"><input name="r" type="reset" value="重置"></td>
        </tr>
       </table>
      </form>
      <!--提交表单结束-->
     </td>
     <td><%=testcomment.Comment_Er("comment")%>请注意:你所输入的内容中,昵称和留言为必须输入的项目!<br>
      不支持html标志</td>
    </tr>
   </table>
  </td>
</tr>
</table>
<%
}
%>
</body>

上一页  [1] [2] 


 
免责声明:作品版权归所属媒体与作者所有!!本站刊载此文不代表同意其说法或描述,仅为提供更多信息。如果您认为我们侵犯了您的版权,请告知!本站立即删除。有异议请联系我们。
文章录入:烟灰缸    责任编辑:烟灰缸 
网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)
| 设为首页 | 加入收藏 | 联系站长 | 友情链接 | 版权申明 | 网站公告 | 管理登录 |