9 Utils

1 设置document.title(兼容微信浏览器)

 1 setDocumentTitle(t){
 2       document.title = t;
 3       let i = document.createElement(‘iframe‘);
 4       i.src = ‘https://app.img.kangfuzi.com/icon/favicon.ico‘;
 5       i.style.display = ‘none‘;
 6       i.onload = function () {
 7           setTimeout(function () {
 8               i.parentNode.removeChild(i);
 9           }, 9);
10       };
11       document.body.appendChild(i);
12   }

2 获取css属性(兼容IE)

 1 getCss(curEle,attr){
 2       let val = null;
 3       let reg = null;
 4       if("getComputedStyle" in window){
 5           val = window.getComputedStyle(curEle,null)[attr];
 6       } else {   //ie6~8不支持上面属性
 7           if(attr === "opacity"){
 8               val = curEle.currentStyle["filter"];
 9               reg = /^alpha\(opacity=(\d+(?:\.\d+)?)\)$/i;
10               val = reg.test(val)?reg.exec(val)[1]/100:1;
11           } else {
12               val = curEle.currentStyle[attr];
13           }
14       }
15       reg = /^(-?\d+(\.\d)?)(px|pt|em|rem)?$/i;
16       return reg.test(val)?parseFloat(val):val;
17   }
时间: 2024-11-10 21:14:08

9 Utils的相关文章

Utils.java

package www.wulian1.com.webview; import java.text.SimpleDateFormat;import java.util.Date;import java.util.Locale; /** * Created by Administrator on 2017/5/22. */public class Utils { public static String getCurrentTime(String format) { Date date = new

org.quartz.utils.UpdateChecker Checking for available updated version of Quartz..

<dependency> <groupId>org.quartz-scheduler</groupId> <artifactId>quartz</artifactId> <version>2.2.1</version> </dependency> <dependency> <groupId>org.quartz-scheduler</groupId> <artifact

org.hibernate.MappingException: Could not determine type for: java.utils.Date

问题描述 org.hibernate.MappingException: Could not determine type for: java.utils.Date, at table: STUDENTS, for columns: [org.hibernate.mapping.Column(DATE)] at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:349) at org.hibernate.mapping.Simp

java.lang.IllegalStateException: class utils.filter.ContentFilter is not a javax.servlet.Filter

1.错误描述 2016-01-12 11:27:01.787:WARN:oejuc.AbstractLifeCycle:FAILED ContentFilter: java.lang.IllegalStateException: class utils.filter.ContentFilter is not a javax.servlet.Filter java.lang.IllegalStateException: class utils.filter.ContentFilter is not

maven打包异常:软件包com.sun.org.apache.xml.internal.security.utils.Base64 不存在

maven打包异常:软件包com.sun.org.apache.xml.internal.security.utils.Base64 不存在 将jre/lib/rt.jar添加到maven的compiler里面  编译正常... <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <versio

Could not initialize class utils.JdbcUtils

今天用JdbcUtils时出现了一个问题,被困扰了一晚上.从网上找的原因,说什么url错了,版本不一致等等都不能解决我的问题, 我写好了一个JdbcUtils准备测试,发现从后台用Dao测试完全没问题,但是servlet一调用就出现Could not initialize class utils.JdbcUtils: 早晨打开tomcat/webapps项目下发现mysql驱动放在XX/lib下:但WEB-INF下的lib没有MySQL驱动,但我明明把mysql驱动放在myeclipes的 WE

Knockout中ko.utils中处理数组的方法集合

每一套框架基本上都会有一个工具类,如:Vue中的Vue.util.Knockout中的ko.utils.jQuery直接将一些工具类放到了$里面,如果你还需要更多的工具类可以试试lodash.本文只介绍一下Knockout中ko.utils中处理数组的一些方法. ko.utils.arrayForEach(array, callback) 与Array.prototype.forEach作用一致.提供函数(回调函数)对数组的每个元素执行一次.使用方法: var arr = [1, 2, 3, 4

Javascript Utils.js

\ var Utils = { //字符串格式化 StringFormat: function () { if (arguments.length == 0) return null; var str = arguments[0]; for (var i = 1; i < arguments.length; i++) { var re = new RegExp('\\{' + (i - 1) + '\\}', 'gm'); str = str.replace(re, arguments[i]);

Utils工具方法集插件详解

var Utils = function(){}; Utils.text = { stripTags: function (val) { return val.replace(/<\/?[^>]+>/gi, "");   //正则表达式中的<\/?其实就是匹配</或<,后面的[^>]+其实就是匹配不是>的任何一个或多个字符,因此此正则可以匹配<div>,</div>,<input type="tex

Utils

using System; using System.Drawing; using System.Windows.Forms; namespace zhbCapture { /// <summary> /// Description of Utils. /// </summary> public class Utils { public static Bitmap screenBmp, srcScreenBmp; public static int screenWidth = Sc