• js例子记载


    1.获取项目路径的,不一定有用,仅作参考用:

    1 function getRootPath() {
    2     var curWwwPath = window.document.location.href;            //"http://localhost:8080/springMVC/jsonTest.jsp"
    3     var pathName = window.document.location.pathname;        // /springMVC/jsonTest.jsp
    4     var pos = curWwwPath.indexOf(pathName);                    // 21
    5     var localhostPath = curWwwPath.substring(0, pos);        //http://localhost:8080
    6     var projectName = pathName.substring(0, pathName.substr(1).indexOf('/') + 1);    //   /springMVC
    7 
    8     return (localhostPath + projectName);    //http://localhost:8080/springMVC
    9 }
    View Code

     2.马士兵shopping项目中动态修改table单元格:

    单元格html:

    js代码:

    说明:

    changeToInput:
    根据id找到span;
    拿到span的value值;
    outerHTML <------> innerHTML outerHTML 将整个的html全部替换掉了;
    显示在input输入框中;获得焦点;
    onblur时候触发change(id)方法,根据id去修改;
    修改响应成功之后,再变回span;
    -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
     3.开始计时和停止计时的小东西
    <!doctype html>
    <html>
    <head>
    <meta charset="utf-8">
    <title>开始计时和停止计时的小东西</title>
    <link rel="stylesheet" type="text/css" href="bootstrap/bootstrap.min.css">
    <style type="text/css">
    .demo {
        padding: 10px;
        margin: 100px 0 0 100px;
    }
    </style>
    </head>
    <body>
    <div class="demo">
        <input type="button" value="开始计时" onClick="timedCount()">
        <input type="text" id="txt">
        <input type="button" value="停止计时" onClick="stopCount()">
    </div>
    </body>
    <script src="jquery/jquery.min.js"></script>
    <script src="bootstrap/bootstrap.min.js"></script>
    <script type="text/javascript">
    var c=0;
    var t;
    function timedCount(){
        document.getElementById("txt").value=c;
        c=c+1;
        t=setTimeout("timedCount()",1000);
    }
    function stopCount(){
        c=0;
        setTimeout("document.getElementById('txt').value=0",0);
        clearTimeout(t);
    }
    </script>
    </html>

     
     
     
     
     
     
     
     
    ----
  • 相关阅读:
    由浅入深之Tensorflow(3)----数据读取之TFRecords
    由浅入深之Tensorflow(2)----logic_regression实现
    由浅入深之Tensorflow(1)----linear_regression实现
    Ubuntu14.04+caffe+cuda7.5 环境搭建以及MNIST数据集的训练与测试
    deeplenrnig学习笔记——什么是特征
    Paper List ABOUT Deep Learning
    C++ vector 用法
    转载:逻辑回归的python实现
    kubernetes 二进制安装1
    kubernetes 二进制安装
  • 原文地址:https://www.cnblogs.com/tenWood/p/6481070.html
Copyright © 2020-2023  润新知