• js常用方法(。。。。不完整)


    lastIndexOf();
    substring();
    split();
    slice();
    splice();
    var s="http://www.baidu.com";
    var i= s.lastIndexOf("."); //16
    var unit= s.substring(i); //.com
    var url= s.substring(0,i);  //http://www.baidu
       addLoadEvent(func1);
       addLoadEvent(func2);
       function addLoadEvent(func){
           var oldonload=window.onload;
           if(typeof window.onload!='function'){
               window.onload=func;
           }else{
               window.onload=function() {
                   oldonload();
                   func();
               }
           }
       };
        function func1(){
            alert("text1");
        };
        function func2(){
            alert("text2");
        };
    <ul id="imagegallery">
            <li><a href="images/ads/1.jpg" title="广告1">广告1</a></li>
            <li><a href="images/ads/2.jpg" title="广告2">广告2</a></li>
            <li><a href="images/ads/3.jpg" title="广告3">广告3</a></li>
            <li><a href="images/ads/4.jpg" title="广告4">广告4</a></li>
        </ul>
        <p id="description">Choose an image</p>
        <img id="placeholder" src="images/ads/adindex.gif" alt="my image gallery">
    window.onload = prepareGallery();
        function prepareGallery() {
            if (!document.getElementsByTagName) return false;
            if (!document.getElementById) return false;
            if (!document.getElementById("imagegallery")) return false;
            var gallery = document.getElementById("imagegallery");
            var links = gallery.getElementsByTagName("a");
            for (var i = 0; i < links.length; i++) {
                links[i].onclick = function () {
                    return showPic(this) ? false : true;
                }
            }
        }
        function showPic(whichpic) {
            if (!document.getElementById("placeholder")) return false;
            var sourse = whichpic.getAttribute("href");
            var placeholder = document.getElementById("placeholder");
            if (placeholder.nodeName != "IMG") return false;
            placeholder.setAttribute("src", sourse);
            //
            if (document.getElementById("description")) {
                var text = whichpic.getAttribute("title") ? whichpic.getAttribute("title") : "";
                var description = document.getElementById("description");
                if (description.firstChild.nodeType == 3) {
                    description.firstChild.nodeValue = text;
                }
            }
            return true;
        }

  • 相关阅读:
    Python·Jupyter Notebook
    CNN(卷积神经网络)、RNN(循环神经网络)、DNN(深度神经网络)概念区分理解
    tensorflow学习
    语料库
    资源 | 数十种TensorFlow实现案例汇集:代码+笔记
    Tensorlayer
    利用 TFLearn 快速搭建经典深度学习模型
    十分钟搞定pandas
    利用python进行数据分析之pandas入门
    Pandas
  • 原文地址:https://www.cnblogs.com/zhaojieln/p/4314224.html
Copyright © 2020-2023  润新知