求助jsp中使用js函数的问题!谢谢!
来源:百度知道 编辑:UC知道 时间:2024/06/22 13:30:39
下面是我的jsp文件:
<%@ 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>用户名惟一性检查</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=
<%@ 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>用户名惟一性检查</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=
1. function beginCheck(){
System.out.println("__1__");
把js里面的 System.out.println("__1__"); 改成alert("进入JS");
确认进入 js方法中
谁告诉你可以再 js里写 System.out.println的?
2. xmlHttp.open("GET","CheckUser?loginName="+tempLoginName);
请确定 CheckUser 请求路劲是否 正确
测试 正确的方法 在 CheckUser对应的类的方法
第一行写句
System.out.println("进入后台AJAX类")
以下是我 的例子 注释好了 希望对你有帮助
<%@ page language="java" import="java.util.*" pageEncoding="GBK"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>第一个AJAX</title>
<script type="text/javascript">
function checkName(value){
//创建XmlHTTPRequest对象
var xmlHttp;
//判断客户端使用的浏览器是什么浏览器
//如果是IE ,使用ActiveXObject