在jsp中用include引用一个jsp页面后 js就不起作用了
---------------引用的js是fancybox的一个插件------------------------<scripttype="text/javascrip...
---------------引用的js是fancybox的一个插件------------------------
<script type="text/javascript">
$(document).ready(function() {
$("a[rel=example_group]").fancybox({
.......................
</script>
----------------------------------------------------------------
<%@include file="../login.jsp"%>
--------------------------------------------------login.jsp--------------------------------
=
<% // web application pathString webAppPath2 = Standard.getWebAppContext(request, response);%>
<%String usr_name = Standard.getSessionAttribute(request,"usr_name");%>
<%if(!Standard.isNullStr(usr_name)) {%>
........................
<script type="text/javascript" src="<%=webAppPath2%>pc_new/template_one/jquery/jquery-1.7.2.min.js"></script>
<script type="text/javascript">
function login(){
$('#submitForm').empty();
$('<input>').attr({type : 'hidden',name : 'username',value : $('#username').val()}).appendTo('#submitForm');
$('<input>').attr({type : 'hidden',name : 'password',value : $('#password').val()}).appendTo('#submitForm');
$('#submitForm').submit();
}
//退出
function loginOut(){
$.ajax({
url:"ForwardServlet?biz=user.loginOut",
type:"post",
dataType:"json",
success:function(obj){
location = location;
},
error:function(){
...........
</script>
报的错误是
TypeError: $(...).fancybox is not a function
-------------------------------
已经找到错误了
在login.jsp中又引用了一次jquery导致了冲突。删除那句引用的话就好了 展开
<script type="text/javascript">
$(document).ready(function() {
$("a[rel=example_group]").fancybox({
.......................
</script>
----------------------------------------------------------------
<%@include file="../login.jsp"%>
--------------------------------------------------login.jsp--------------------------------
=
<% // web application pathString webAppPath2 = Standard.getWebAppContext(request, response);%>
<%String usr_name = Standard.getSessionAttribute(request,"usr_name");%>
<%if(!Standard.isNullStr(usr_name)) {%>
........................
<script type="text/javascript" src="<%=webAppPath2%>pc_new/template_one/jquery/jquery-1.7.2.min.js"></script>
<script type="text/javascript">
function login(){
$('#submitForm').empty();
$('<input>').attr({type : 'hidden',name : 'username',value : $('#username').val()}).appendTo('#submitForm');
$('<input>').attr({type : 'hidden',name : 'password',value : $('#password').val()}).appendTo('#submitForm');
$('#submitForm').submit();
}
//退出
function loginOut(){
$.ajax({
url:"ForwardServlet?biz=user.loginOut",
type:"post",
dataType:"json",
success:function(obj){
location = location;
},
error:function(){
...........
</script>
报的错误是
TypeError: $(...).fancybox is not a function
-------------------------------
已经找到错误了
在login.jsp中又引用了一次jquery导致了冲突。删除那句引用的话就好了 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询