• $(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/> 。。。。。。。。。
  • 相关阅读:
    [转] 微服务架构
    vue拦截器实现统一token,并兼容IE9验证
    一句话 道出设计模式
    老话闲说,关于身份证号码的验证
    值得珍藏的HTTP协议详解
    微信内嵌H5网页 解决js倒计时失效
    使用JavaScript重定向URL参数
    Nodejs --我自己的学习笔记
    ONLY三行脚本 SQL数据恢复到指定时间点
    [转] 数据库加锁 sql加锁的
  • 原文地址:https://www.cnblogs.com/isme-zjh/p/12664073.html
Copyright © 2020-2023  润新知