日期:2014-05-18  浏览次数:20710 次

关于生成验证码的问题
我有个静态页面要调用一个jsp页面生成一个验证码,我改怎样写。大家指教一下。
html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="keywords" content="" />
<title>首页 - </title>
<link href="css/site.css" rel="stylesheet" type="text/css">
<script language="javascript">
<!--
function docheck(){
if(document.form1.author.value.length<=1){
alert("请输入昵称!");
document.form1.author.focus();
return false;
}
if(document.form1.contact.value.length<=2){
alert("联系方式请留详细点,以方便联系!");
document.form1.contact.focus();
return false;
}
if(document.form1.question.value.length<5){
alert("请把内容写长些!");
document.form1.question.focus();
return false;
}
if(document.form1.question.value.length>520){
alert("内容太长了,请控制在260个字以内!");
document.form1.question.focus();
return false;
}
if(document.form1.all("code").value == null || document.form1.all("code").value == "" ){
alert("请输入检验码!");
document.form1.all("code").focus();
return false;
}
document.form1.submit();
return true;
}
//-->
</script>
<style type="text/css">
<!--
.rightbox td{padding:5px;}
-->
</style>
</head>
<body>

  <!--中间样式开始-->
<div class="main">
  <div class="leftbox">
  <h2>在线留言</h2> 
  <ul>
  <li class="pic"><img src="images/left_rjdz1.jpg" /></li>
  </ul>
  <h3><a href="about4.html" target="_blank" class="left_link3">联系我们</a></h3>

  <div class="rightbox">
  <h2>在线留言</h2>
  <p><br>
  <form id="form1" name="form1" method="post" action="" target="_self">
  <table width="100%" border="0" cellpadding="5" cellspacing="1" bgcolor="#F3F3F3">
  <tr>
  <input type="hidden" name="cid" value="001" />
  <td width="13%" bgcolor="ffffff" ><div align="right">昵&nbsp;&nbsp;&nbsp;&nbsp;称:</div></td>
  <td width="87%" nowrap="nowrap" bgcolor="ffffff" ><div align="left">
  <input name="author" type="text" size="16" maxlength="16" style="font-size:12px"/>
  </div></td>
  </tr>
  <tr>
  <td bgcolor="ffffff" ><div align="right">联系方式:</div></td>
  <td nowrap="nowrap" bgcolor="ffffff" ><div align="left">
  <input name="contact" type="text" size="38" style="font-size:12px"/>
  (该项不会被公开显示,只有网站客服人员才能看到)</div></td>
  </