
jsp页面中,不能调用js文件里面的function
jsp页面的代码<html><head><title>测试页面</title><metahttp-equiv="pragma"content="no-cache"><me...
jsp页面的代码
<html>
<head>
<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">
<script src="/admin/js/order.js" type="text/javascript"></script>
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>
<body>
<button onclick='f_test(9)'>button</button>
</body>
</html>
在WebRoot的/admin/js/order.js文件中,有一个function
function f_test(par){
alert(par;
}
但是。。为什么我点击那个button的时候,完全没反应。。T_T 求大神赐教 展开
<html>
<head>
<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">
<script src="/admin/js/order.js" type="text/javascript"></script>
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>
<body>
<button onclick='f_test(9)'>button</button>
</body>
</html>
在WebRoot的/admin/js/order.js文件中,有一个function
function f_test(par){
alert(par;
}
但是。。为什么我点击那个button的时候,完全没反应。。T_T 求大神赐教 展开
3个回答
展开全部
首先应该判断你引用的JS文件路径有没有写错,判断方法,按住控制键,并且鼠标单击路径,如果能够进入你写的JS文件说明你引入的JS文件路径是没有错的。如果你用的IE,点击没有反应的话你的,IE的左下角也会显示,网页有错误的警告,你的JS方法是不是粘贴进来的呢?因为你的alert();写错了,你忘记了一个右括号。望采纳,谢谢!
展开全部
jsp页面中,不能调用js文件里面的function的解决方法
1、确保js文件已加载
2、确保js无错误
1、确保js文件已加载
2、确保js无错误
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
如果引用js无效的话你改成页内js,如果页内js有效就是路径问题,否则就是js代码有问题。
还有你的alert少一半括号。
还有你的alert少一半括号。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询