这是我打开页面时获取验证码代码
<img id="imgwd" src="servlet/ValidateServlet" onclick="getOther()" />
我想实现单击一下验证码后换一张新的验证码,是这么写的
function getOther(){
var img =document.getElementById( "imgwd ");
img.src= "servlet/ValidateServlet"+ new Date().getTime;
}
这两个在同一个jsp中,现在img.src= "servlet/ValidateServlet"+ new Date().getTime;这个没好使,现在单击没有效果,哪位大侠帮帮忙~~~~~~
<img id="imgwd" src="servlet/ValidateServlet" onclick="getOther()" />
我想实现单击一下验证码后换一张新的验证码,是这么写的
function getOther(){
var img =document.getElementById( "imgwd ");
img.src= "servlet/ValidateServlet"+ new Date().getTime;
}
这两个在同一个jsp中,现在img.src= "servlet/ValidateServlet"+ new Date().getTime;这个没好使,现在单击没有效果,哪位大侠帮帮忙~~~~~~
解决方案 »
- 求js读取sqlite数据库的例子
- 求解:Resin启动错误
- 怎么把<select>...</select>选到的值传递到下个JSP页面?
- Spring+Hibernate+MySQL+Proxool 配置错误
- 一个关键字提示的算法设计
- 一个配置问题.请大家帮忙解决下.谢谢~
- 有没有那个大哥在东方国信工作或面试过?
- JSP初级问题
- 如何读取Serializable序列化后的对像?
- 我在写jsp程序时为什么会出现找不到Bean的情况
- java_web项目我都改名了,context root 我也改了,webapps的发布包也删了,重新部署,原名为什么还能正常访问?
- 为什么这个文件双击之后显示空白
<%@ page language="java" import="java.util.*" pageEncoding="GBK"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://"
+ request.getServerName() + ":" + request.getServerPort()
+ path + "/";
%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>"> <title>登录</title> <meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
<script type="text/javascript" src="jscript/jsutil.js"></script>
</head> <body>
<center>
<h3>
请输入用户名和密码来登录
</h3>
单击此处
<a href="regist.jsp">注册</a>
<br>
<a href="forgetPwd1.jsp">忘记密码?</a>
<s:form action="login.action" method="post">
<s:textfield name="username" label="用户名"></s:textfield>
<s:password name="password" label="密码"></s:password>
<s:textfield name="code" label="验证码"></s:textfield>
<s:submit value="提交" />
</s:form>
<label for="rand">验证码:</label>
<img src="rand.action" id="rand" />
<a href="javascript:void(0)"
onclick="changeValidateCode();return false;">看不清,换一张</a>
</center>
</body>
</html>
function changeValidateCode() {
var timenow = new Date().getTime();
document.getElementById("rand").src = "rand.action?d=" + timenow;
}
var img =document.getElementById( "imgwd "); //这里后面多了个空格
img.src= "servlet/ValidateServlet"+ new Date().getTime;
// 你的拦截是哪个呀?
// img.src= "servlet/ValidateServlet?i="+ new Date().getTime; ?
}