myeclipse中创建jsp中的javascript如何获取html中password的值
<%@pagelanguage="java"import="java.util.*"pageEncoding="gbk"%><%Stringpath=request.ge...
<%@ page language="java" import="java.util.*" pageEncoding="gbk"%>
<%
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>注册旅8</title>
<script type="text/javascript">
function register(){
var rPassword_1=document.getElementById("rPassword_1").value; //写时系统提示只有valueOf,没有value。 why?
var rPassword_2=document.getElementById("rPassword_2").value;
alert(rPassword_1+rPassword_1);
}
</script> //为什么这消息框弹不出来,rPassword_1,rPassword_2也取不上值
</head>
<body>
<br><br><br><br>
<form>
<table align="center" >
<tr><th colspan=2><hr></th>.</tr>
<tr align="center" height="40">
<td align="right" valign="middle" width="220"><font size="5">用户名</font></td>
<td align="center" valign="middle" width="200"><input type="text" size="20" name="rUsername"></td>
</tr>
<tr align="center" height="40">
<td align="right" valign="middle" width="220"><font size="5">密 码</font></td>
<td align="center" valign="middle" width="200"><input type="password" size="21" id="rPassword_1"></td>
</tr>
<tr align="center" height="40">
<td align="right" valign="middle" width="220"><font size="5">密码确认</font></td>
<td align="center" valign="middle" width="200"><input type="password" size="21" id="rPassword_2"></td>
</tr>
<tr align="center" height="60" valign="bottom"><th colspan=2> <input type="button" value="立即注册" style="width:100px;height:40px" onClick="register()"></th></tr>
</table>
</form>
</body>
</html>
问题两个在上面写的呢 展开
<%
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>注册旅8</title>
<script type="text/javascript">
function register(){
var rPassword_1=document.getElementById("rPassword_1").value; //写时系统提示只有valueOf,没有value。 why?
var rPassword_2=document.getElementById("rPassword_2").value;
alert(rPassword_1+rPassword_1);
}
</script> //为什么这消息框弹不出来,rPassword_1,rPassword_2也取不上值
</head>
<body>
<br><br><br><br>
<form>
<table align="center" >
<tr><th colspan=2><hr></th>.</tr>
<tr align="center" height="40">
<td align="right" valign="middle" width="220"><font size="5">用户名</font></td>
<td align="center" valign="middle" width="200"><input type="text" size="20" name="rUsername"></td>
</tr>
<tr align="center" height="40">
<td align="right" valign="middle" width="220"><font size="5">密 码</font></td>
<td align="center" valign="middle" width="200"><input type="password" size="21" id="rPassword_1"></td>
</tr>
<tr align="center" height="40">
<td align="right" valign="middle" width="220"><font size="5">密码确认</font></td>
<td align="center" valign="middle" width="200"><input type="password" size="21" id="rPassword_2"></td>
</tr>
<tr align="center" height="60" valign="bottom"><th colspan=2> <input type="button" value="立即注册" style="width:100px;height:40px" onClick="register()"></th></tr>
</table>
</form>
</body>
</html>
问题两个在上面写的呢 展开
2个回答
2013-03-29
展开全部
没有什么问题
这样写可以的
这样写可以的
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询