zoukankan      html  css  js  c++  java
  • JS类小功能

    工作中,总是要处理一些前端的小功能。都是网上搜的JS脚本

    <script>
        //防止页面后退 
        history.pushState(null, null, document.URL);
        window.addEventListener('popstate', function () {
            history.pushState(null, null, document.URL);
        });
    </script>

    判断是否微信浏览器,相应显示与隐藏html元素

    <script type="text/javascript">
        function is_weixn(){
            var ua = navigator.userAgent.toLowerCase();
            if(ua.match(/MicroMessenger/i)!="micromessenger") {
                var box=document.getElementById("notify"); //div or span 
                var box2=document.getElementById("submit"); //<input id="submit" type="submit" value="提 交"> 
                box.style.display="inline";
                box2.style.display="none";
            } else {
                return false;
            }
        }
    </script>
    <body onload="is_weixn()">

    定时滚动的文本框:

    <script type="text/javascript">
    function startmarquee(lh,speed,delay,index){ 
        var t; 
        var p=false; 
        var o=document.getElementById("marqueebox"+index); 
        o.innerHTML+=o.innerHTML; 
        o.onmouseover=function(){p=true} 
        o.onmouseout=function(){p=false} 
        o.scrollTop = 0; 
        function start(){ 
            t=setInterval(scrolling,speed); 
            if(!p){ o.scrollTop += 1;} 
        } 
        function scrolling(){ 
            if(o.scrollTop%lh!=0){ 
                o.scrollTop += 1; 
                if(o.scrollTop>=o.scrollHeight/2) o.scrollTop = 0; 
            }else{ 
                clearInterval(t); 
                setTimeout(start,delay); 
            } 
        } 
        setTimeout(start,delay); 
    } 
    startmarquee(72,20,5000,0); 
    </script>
    <!-- html 部分-->
    <div class="box" id="marqueebox0"> 
    <div id="safetxt">...</div>
    <div id="safetxt2">...</div>
    </div>
  • 相关阅读:
    神经网络之非线性分类器——神经网络
    卷积神经网络之迁移学习
    卷积神经网络之卷积的结构和参数的多少
    卷积神经网络之卷积的物理意义
    神经网络的后续改进
    图像的矩 图像的轮廓面积和长度
    包围轮廓的矩形边界 opencv
    Linux中的环境变量配置文件及其作用
    Linux中的数值运算
    Linux中接收键盘输入
  • 原文地址:https://www.cnblogs.com/frx9527/p/webfront.html
Copyright © 2011-2022 走看看