zoukankan      html  css  js  c++  java
  • 灰姑娘专题总结

    http://cinderella.1905.com/

    前两天加急做了一个专题,后来增改了不少东西,还是略吃力。

    ================================================    分割线    ===========================================================

    1) 页面内添加如下代码,为学员的信息不包含排名。先追加

    <script type="text/javascript">
    var SPECIALCONFIG = {
        nav_tabname : 'index',
        voteids : "321834318,321834321,321834332,321834333,321834338,321833823,321833824,321842611,321842613,321842616,321842617,321842618,321842620,321842624",
        infos : {"321834318":{"id":321834318,"title":"u9732u897fu00b7u5b9du901a","url":"http://www.1905.com/http://www.1905.com/mdb/star/2700989/","thumb":"http://image11.m1905.cn/uploadfile/2014/1216/20141216025708535339.jpg"},"321834321":{"id":321834321,"title":"u4e9au5386u5c71u5fb7u62c9u00b7u9053u7075","url":"http://www.1905.com/http://www.1905.com/mdb/star/3042415/","thumb":"http://image11.m1905.cn/uploadfile/2014/1216/20141216030224142148.jpg"},"321834332":{"id":321834332,"title":"u4f0au6069u00b7u9ea6u67efu8096u6069","url":"http://www.1905.com/http://www.1905.com/mdb/star/1470642/","thumb":"http://image11.m1905.cn/uploadfile/2014/1216/20141216031510179309.jpg"},"321834333":{"id":321834333,"title":"u6734u96c5u82f1","url":"http://www.1905.com/http://www.1905.com/mdb/star/3042417/","thumb":"http://image11.m1905.cn/uploadfile/2014/1216/20141216031527780475.jpg"},"321834338":{"id":321834338,"title":"u5d14u6b63u5143","url":"http://www.1905.com/http://www.1905.com/mdb/star/3042418/","thumb":"http://image11.m1905.cn/uploadfile/2014/1216/20141216032521520919.jpg"},"321833823":{"id":321833823,"title":"u6734u653fu739f","url":"http://www.1905.com/http://www.1905.com/mdb/star/3042407/","thumb":"http://image11.m1905.cn/uploadfile/2014/1215/20141215031653221905.jpg"},"321833824":{"id":321833824,"title":"u91d1u5ba5u771f","url":"http://www.1905.com/http://www.1905.com/mdb/star/3042408/","thumb":"http://image11.m1905.cn/uploadfile/2014/1215/20141215032147123433.jpg"},"321842611":{"id":321842611,"title":"u5f20u99a8u5143","url":"http://www.1905.com/http://www.1905.com/mdb/star/3042353/","thumb":"http://image11.m1905.cn/uploadfile/2014/1211/20141211034324770365.jpg"}
            }
    };
    </script>

    列表页执行js的时候会提示 SPECIALCONFIG 未定义,此时判断只有页面内有 SPECIALCONFIG 的时候出现了问题。

    判断SPECIALCONFIG.length   结果 undefined

    当不知道怎么判断的时候 可以typeof(SPECIALCONFIG)看下它是什么类型    输出 "object"  ,所以可以通过这点判断  

    if(typeof(SPECIALCONFIG) == 'object'){

      执行响应操作;

    }

    2) js追加上面代码里面的信息到html的时候,需要for in遍历

    for(var m in SPECIALCONFIG.infos){

    }

    3) 获取当前时间的方法

    A)  new Date().getTime() 返回的是当前时间的毫秒数

    B)  拼成201412231542这种格式的    

    date.getFullYear().toString() + (date.getMonth()+1).toString() + date.getDate().toString() + date.getHours().toString() + date.getMinutes().toString();

         date.getFullYear()获取到的是数字 用加号不能直接拼接,只能转化为字符串进行拼接   toString()

     4) sort() 方法

         var arr = [1,5,3,9];

       arr.sort();    //[1,3,5,9]

         var arr = [10,5,40,25,1000,1].sort();    // 10,5,40,25,1000,1

         sort() 不按照数值的大小对数字进行排序,要实现这一点,就必须使用一个排序函数:

    <script type="text/javascript">
    function sortNumber(a,b) { return a - b } var arr = new Array(6) arr[0] = "10" arr[1] = "5" arr[2] = "40" arr[3] = "25" arr[4] = "1000" arr[5] = "1"document.write(arr.sort(sortNumber))
    </script>

    5) http://www.1905.com/api/specialvote/special3203.html   请求接口 数据格式是jsonp

    $.ajax({
    type: "GET",
    url : "http://www.1905.com/api/specialvote/special3203.html?time="+freshTime,
    dataType:"jsonp",
    jsonpCallback:"successCallback",  //请求接口中的回调函数名称
    cache : true,

    cache

    类型:Boolean

    默认值: true,dataType 为 script 和 jsonp 时默认为 false。设置为 false 将不缓存此页面。

  • 相关阅读:
    Redhat6.4安装MongoDBv3.6.3
    windows模糊查询指定进程是否存在
    Linux普通用户不能使用TAB键、上下键
    零基础Python爬虫实现(百度贴吧)
    零基础Python爬虫实现(爬取最新电影排行)
    让bat批处理后台运行,不显示cmd窗口(完全静化)
    根据进程名监控进程(邮件提醒)
    android 开发中,必须要注意的知识点. (持续更新)
    Android上传文件至服务器
    为应用添加多个Activity与参数传递
  • 原文地址:https://www.cnblogs.com/jiangtuzi/p/4180272.html
Copyright © 2011-2022 走看看