zoukankan      html  css  js  c++  java
  • jsp页面部分知识点[一直更]

    【1】:除去页面空行

     <%@ page trimDirectiveWhitespaces="true" %>

    【2】:加标题左侧图标

        <!--  '/image/horse.ico' 为项目中的ico图标路径 -->
         <link rel="shortcut icon" href="<%=path %>/image/horse.ico" type="image/x-icon"/>
    

      

    【3】:js获取当前上网国家/省份/城市

      var country = '';
      var province = '';
      var scity = '';
      $.getScript('http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js', function() {
        country = remote_ip_info.country;
        province = remote_ip_info.province;
        city = remote_ip_info.city;
      });

     【4】判断设备类型,用于区分PC与移动端

    //判断设备类型,用于区分PC与移动端
    function getDeviceType() {
        var dtype="00";
        var sUserAgent = navigator.userAgent.toLowerCase();
        var bIsIpad = sUserAgent.match(/ipad/i) == "ipad";
        var bIsIphoneOs = sUserAgent.match(/iphone os/i) == "iphone os";
        var bIsMidp = sUserAgent.match(/midp/i) == "midp";
        var bIsUc7 = sUserAgent.match(/rv:1.2.3.4/i) == "rv:1.2.3.4";
        var bIsUc = sUserAgent.match(/ucweb/i) == "ucweb";
        var bIsAndroid = sUserAgent.match(/android/i) == "android";
        var bIsCE = sUserAgent.match(/windows ce/i) == "windows ce";
        var bIsWM = sUserAgent.match(/windows mobile/i) == "windows mobile";
        if (bIsIpad || bIsIphoneOs || bIsMidp || bIsUc7 || bIsUc || bIsAndroid || bIsCE || bIsWM) {
            dtype="01";//移动
        }
        return dtype;
    }
  • 相关阅读:
    窗口切换快捷键
    简单排序算法
    (转)Zen Coding 让 Notepad++ 代码书写健步如飞
    (转)图解SQL的Join
    第6章 AJAX
    今天是五四青年节
    看到的php的小知识
    (转)Notepad++配合QuickText打造快速高效的文本编辑器
    一种非常好的产生"唯一"临时文件的办法
    (转)linux 目录结构及其含义
  • 原文地址:https://www.cnblogs.com/ai211234/p/6381668.html
Copyright © 2011-2022 走看看