<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
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">
function my_submit(form){
if(form.uid.value = ""||form.uid.value = null){
alert("用户名不能为空");
form.uid.focus();
return false;
}
if(form.pwd.value = ""||form.pwd.value = null){
alert("用户名不能为空");
form.pwd.focus();
return false;
}
form.action = "login2.jsp";
form.submit();
return true;
}
function onRegister(form){
form.action = "register.jsp"
form.submit();
return true;
}
</script> </head>
<body>
<form method="post" name="f1">
<center>
<h2>用户登录</h2>
<table>
<tr>
<td>
姓名:
</td>
<td>
<input type="text" name="uid">
</td>
</tr>
<tr>
<td>
密码:
</td>
<td>
<input type="text" name="pwd">
</td>
</tr>
<tr>
<td>
<input type="submit" name="Submit" value=" 确定 " onclick="return my_submit(f1)" >
</td>
<td>
<input type="button" name="register" value=" 注册 " onclick="return onRegister(f1)" >
</td>
</tr>
</table>
</center>
</form>
</body>
</html>点击 确定 或者 注册 都没有反应 我看了好几遍 没有发现什么问题
顺便问下 javascirpt有什么办法调试吗? 好麻烦 有问题都不知道如何排查 我用的是myecplise
<%
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">
function my_submit(form){
if(form.uid.value = ""||form.uid.value = null){
alert("用户名不能为空");
form.uid.focus();
return false;
}
if(form.pwd.value = ""||form.pwd.value = null){
alert("用户名不能为空");
form.pwd.focus();
return false;
}
form.action = "login2.jsp";
form.submit();
return true;
}
function onRegister(form){
form.action = "register.jsp"
form.submit();
return true;
}
</script> </head>
<body>
<form method="post" name="f1">
<center>
<h2>用户登录</h2>
<table>
<tr>
<td>
姓名:
</td>
<td>
<input type="text" name="uid">
</td>
</tr>
<tr>
<td>
密码:
</td>
<td>
<input type="text" name="pwd">
</td>
</tr>
<tr>
<td>
<input type="submit" name="Submit" value=" 确定 " onclick="return my_submit(f1)" >
</td>
<td>
<input type="button" name="register" value=" 注册 " onclick="return onRegister(f1)" >
</td>
</tr>
</table>
</center>
</form>
</body>
</html>点击 确定 或者 注册 都没有反应 我看了好几遍 没有发现什么问题
顺便问下 javascirpt有什么办法调试吗? 好麻烦 有问题都不知道如何排查 我用的是myecplise
== 是比较。ie developer: 按F12(IE7以后。)
ff firebug 安装插件后按F12
<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">
function my_submit(){
if(f1.uid.value == ""||f1.uid.value == null){
alert("用户名不能为空");
f1.uid.focus();
return false;
}
if(f1.pwd.value == ""||f1.pwd.value == null){
alert("用户名不能为空");
f1.pwd.focus();
return false;
}
f1.action = "login2.jsp";
f1.submit();
return true;
}
function onRegister(){
f1.action = "register.jsp"
f1.submit();
return true;
}
</script> </head>
<body>
<form method="post" name="f1">
<center>
<h2>用户登录</h2>
<table>
<tr>
<td>
姓名:
</td>
<td>
<input type="text" name="uid">
</td>
</tr>
<tr>
<td>
密码:
</td>
<td>
<input type="text" name="pwd">
</td>
</tr>
<tr>
<td>
<input type="submit" name="Submit" value=" 确定 " onclick="return my_submit()" >
</td>
<td>
<input type="button" name="register" value=" 注册 " onclick="return onRegister()" >
</td>
</tr>
</table>
</center>
</form>
</body>
</html>