在要求输入邮箱的文本域,请填写真实的邮件地址。非真实邮件地址,将收不到回复信息。

2016年07月2日的内容

JavaScript

JavaScript获取用户的DPI

在某些情况下,需要获得用户的DPI。以下方法是用JavaScript实现获取用户的DPI。 function getDPI() { var arrDPI = new Array; var devicePixelRatio = window.devicePixelRatio || 1; var tmpNode = document.createElement("DIV"); tmpNode.style.cssText = "height: 1in; left: -100%; position: absolute; top: -100%; width: 1in;"; document.body.appendChild(tmpNode); arrDPI[0] = parseInt(tmpNode.o...

8年前 (2016-07-02) 1594℃ 0评论 3喜欢

JavaScript

JavaScript实现金额转为大写

此方法为招商银行网上银行对金额进行大写的转换方法。 function ConvertUpperMoney(whole) { //金额转换。输入数字字符串,低至分位,高位不为零 var GBK_unit1 = "分角"; var GBK_unit2 = "圆拾佰仟"; var GBK_unit3 = "万拾佰仟" var GBK_unit4 = "亿拾佰仟"; var GBK_num = "零壹贰叁肆伍陆柒捌玖"; var section1 = ""; if (whole.length - 2 >= 0) section1 = whole.substr(whole.length - 2, 2); else section1 = whole.substr(0, whole.length); ...

8年前 (2016-07-02) 581℃ 0评论 0喜欢

JavaScript

Javascript简单实现HTML元素抖动效果

<!doctype html> <html> <head> <meta charset="utf-8"> <title></title> <script type="text/javascript">function shake(id) { var style = document.getElementById(id).style, p = [4, 8, 4, 0, -4, -8, -4, 0], fx = function() { style.marginLeft = p.shift() + 'px'; if (p.length <= 0) { style.marginLeft = 0; ...

8年前 (2016-07-02) 749℃ 0评论 1喜欢