$(document).ready(function() {。。。。。})里面的所有的代碼都不執行(不執行初始化腳本)


原因在於自己在編寫頁面的時候,<script>....</script>的位置放錯了,應該放到<head></head>之間,否則的話,會不起作用

<%@ page contentType="text/html; charset=utf-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
<title>訂單添加</title>
<meta http-equiv="Content-Type" content="default"  name="decorator">
</head>
<script type="text/javascript">

$(document).ready(function(){
XXXXXX........里面的代碼不會執行
});
</script>

<body> <ul class="nav nav-tabs">
<li><a href="${ctx}/sys/order/list">訂單列表</a></li>
<li class="active"><a href="${ctx}/sys/order/form?orderId=${order.orderId}">訂單<shiro:hasPermission name="sys:order:edit">${not empty order.orderId? '修改':'添加' }
</shiro:hasPermission><shiro:lacksPermission name="sys:order:edit">查看</shiro:lacksPermission></a></li> </ul><br/>

。。。。。。。。。

下面是更正之后的,這樣在進入這個頁面的時候,

$(document).ready(function(){   }   的內容才會起作用!

這里提示大家千萬不要這么粗心啦!

<%@ page contentType="text/html; charset=utf-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
<title>訂單添加</title>
<meta http-equiv="Content-Type" content="default"  name="decorator">
<script type="text/javascript">

 $(document).ready(function(){ 
       XXXXXX........里面的代碼不會執行
 });
 </script>
</head> 
<body>
<ul class="nav nav-tabs">
<li><a href="${ctx}/sys/order/list">訂單列表</a></li>
<li class="active"><a href="${ctx}/sys/order/form?orderId=${order.orderId}">訂單
<shiro:hasPermission name="sys:order:edit">${not empty order.orderId? '修改':'添加' }
</shiro:hasPermission><shiro:lacksPermission name="sys:order:edit">查看</shiro:lacksPermission></a></li> </ul>
<br/> 。。。。。。。。。

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM