我今天刚开始学这个,跟着教程做了,但是出不来想要的效果,请大家帮我看下。yan.jsp 页面(贴了重要的东西出来)<script type="text/javascript" src="js/yan.js"></script><script type="text/javascript" src="js/jquery-1.4.2.js"></script>
yan.js 页面
$(document).ready(function(){
alert("帅哥你好");
});
请问哪里错误了 我也在js文件里 放了jquery-1.4.2.js文件了
yan.js 页面
$(document).ready(function(){
alert("帅哥你好");
});
请问哪里错误了 我也在js文件里 放了jquery-1.4.2.js文件了
换成绝对路径就一定可以了
路径是不会错误的,我也按照那样的路径写了个CSS 能够出现效果
我吧 yan.js文件里的内容 改成 alert("帅哥你好");
就可以蹦出来那个提示
<%
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>
<style type="text/css">
.af
{
border: 1px solid red;
background-image: url("232323.jpg");
background-position: bottom;
}
</style><script type="text/javascript" src="js/yan.js"></script><script type="text/javascript" src="js/jquery-1.4.2.js"></script>
<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">
-->
</head>
<body>用户校验<br><br>请输入用户:<input type="text" name="uname" id="uname" class="af"><input type="button" value="登录" id="go"><div> </div>
</body>
</html>
好纠结呀。
jquery-1.4.2.js这个文件必须是所有引入的文件中第一个被引入的!
这样试试 加上..