ie

原生js绑定和解绑事件,兼容IE,FF,chrome

ぐ巨炮叔叔 提交于 2019-12-21 03:27:56
   主要是最近项目中用到了原生的js 解绑和绑定 事件 然后今天研究了一下,其实问题不大,不过要注意不要把单词写错了,今天我就找了好久单词写错了。    需求:当鼠标移上去以后,给Select加载元素,接着解除这个事件。贴上代码,这个是可以运行的,兼容 IE FF chrome    1 <html> 2 <head> 3 <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> 4 <title>js绑定和解绑事件</title> 5 </head> 6 <body> 7 选择 8 <select id="sel1"> 9 <option>--请选择--</option> 10 </select> 11 12 <br/> 13 <br/> 14 <br/> 15 <br/> 16 <br/> 17 <br/> 18 <br/> 19 <br/> 20 选择2 21 <select id="sel2"> 22 <option>--请选择--</option> 23 </select> 24 25 26 27 28 <script type="text/javascript"> 29 30 var _obj = {}; 31 32 // 事件绑定 33 _obj.bindHandler =

基于jquery 的插件,让IE支持placeholder属性

孤人 提交于 2019-12-21 03:25:13
开发一个项目的时候为了美观和用户体验用到了input标签的placeholder属性,但是这个属性是html5中的,所以低版本的IE浏览器不支持。于是在百度找了一些解决方法,找了好几个都不是那么完美,最后决定将其中的一个拿来完善一下。 完善后的代码如下: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 jQuery.fn.placeholder = function (){ var i = document.createElement( 'input' ),placeholdersupport = 'placeholder' in i; if (!placeholdersupport){ var inputs = jQuery( this ); inputs.each( function (){ var input = jQuery( this ), text = input.attr( 'placeholder' ), pdl = 0,height = input.outerHeight(), width = input.outerWidth(), placeholder

IE不支持HTML5表单属性placeholder的解决办法

放肆的年华 提交于 2019-12-21 03:22:51
1. [代码][JavaScript]代码 (function ($) { $.fn.placeholder = function (options) { var defaults = { pColor: "#ccc", pActive: "#999", pFont: "14px", activeBorder: "#080", posL: 8, zIndex: "99" }, opts = $.extend(defaults, options); // return this.each(function () { if ("placeholder" in document.createElement("input")) return; $(this).parent().css("position", "relative"); var isIE = $.browser.msie, version = $.browser.version; //不支持placeholder的浏览器 var $this = $(this), msg = $this.attr("placeholder"), iH = $this.outerHeight(), iW = $this.outerWidth(), iX = $this.position().left, iY = $this.position()

【jquery】基于 jquery 实现 ie 浏览器兼容 placeholder 效果

岁酱吖の 提交于 2019-12-21 03:22:23
placeholder 是 html5 新增加的属性,主要提供一种提示(hint),用于描述输入域所期待的值。该提示会在输入字段为空时显示,并会在字段获得焦点时消失。placeholder 属性适用于以下类型的 input 标签:text, search, url, telephone, email 以及 password。 我们先看下在谷歌浏览器中的效果,如图所示: 获得焦点时: 输入字段: 因为是 html5 属性,自然低版本的浏览器比如 ie6-8 不兼容。下面就介绍下如何在低版本浏览器中显示以上效果,话不多说直接上代码。 html: <!doctype html> <html lang="en"> <head> <meta charset="UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/> <meta name="renderer" content="webkit"/> <meta name="keywords" content=""/> <meta name="description" content=""/> <title>基于 jquery 实现 ie 浏览器兼容 placeholder 效果</title> <style> *{margin:0;padding:0;}

【jquery】基于 jquery 实现 ie 浏览器兼容 placeholder 效果

两盒软妹~` 提交于 2019-12-21 03:21:08
原文链接: http://www.cnblogs.com/yjzhu/p/4398835.html placeholder 是 html5 新增加的属性,主要提供一种提示(hint),用于描述输入域所期待的值。该提示会在输入字段为空时显示,并会在字段获得焦点时消失。placeholder 属性适用于以下类型的 input 标签:text, search, url, telephone, email 以及 password。 我们先看下在谷歌浏览器中的效果,如图所示: 获得焦点时: 输入字段: 因为是 html5 属性,自然低版本的浏览器比如 ie6-8 不兼容。下面就介绍下如何在低版本浏览器中显示以上效果,话不多说直接上代码。 html: <!doctype html> <html lang="en"> <head> <meta charset="UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/> <meta name="renderer" content="webkit"/> <meta name="keywords" content=""/> <meta name="description" content=""/> <title>基于 jquery 实现 ie 浏览器兼容

盒模型布局相关-基础与语法

拈花ヽ惹草 提交于 2019-12-20 05:03:55
/*--> */ /*--> */ HTML标签的类型 ①块级标签 独占一行 的标签,能 随时设置宽度和高度 (比如div、p、h1、ul、li) ②行内标签 多个行内标签能 同时显示在一行 , 宽度和高度取决于内容的尺寸 。( 设置高度无效 ) ③行内块级标签 多个行内-块级标签可以 显示在同一行 ,能 随时设置宽度和高度 (比如input、button) 案例: <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>常见的标签类型</title> <style> div{ background-color: red; width: 150px; /*块级-->行内 块级标签*/ display: inline-block; } p{ background-color: yellow; display: inline; } span{ background-color: blueviolet; height: 90px; /*变成独占一行 行内-->块级标签*/ display: block; } button{ width: 200px; height: 80px; } </style> </head> <body> <!--块级标签--> <div>我是div</div> <p>段落标签</p> <!-

没有Javascript,纯CSS下拉菜单-IE,FF

有些话、适合烂在心里 提交于 2019-12-20 00:09:33
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd" [ <!ELEMENT a (#PCDATA | table)* > ]> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" > <head> <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" /> <title>纯CSS下拉菜单,兼容IE和FF</title> <style type="text/css"> body {color:#fff;} #wrapper {color:#000;} .red {color:#c00;} #info {margin-top:20px;} #info h1 {font-size:3em; text-align:center; font-family: georgia, "times new roman", serif;} #head {height:145px; border:0;} #positioner {clear:both; position:relative; left

IE清除默认的三角形

[亡魂溺海] 提交于 2019-12-19 11:46:09
/* ie 清理默认的三角 */ select : : - ms - expand { display : none ; } jQuery . fn . forceNumeric = function ( ) { return this . each ( function ( ) { $ ( this ) . keydown ( function ( e ) { var key = e . which || e . keyCode ; new_key = key ; // if (!e.shiftKey && !e.altKey && !e.ctrlKey && // // numbers // key >= 48 && key <= 57 || // // Numeric keypad // key >= 96 && key <= 105 || // // comma, period and minus, . on keypad // key == 190 || key == 188 || key == 109 || key == 110 || // // Backspace and Tab and Enter // key == 8 || key == 9 || key == 13 || // // Home and End // key == 35 || key == 36

JS获取计算机信息

匆匆过客 提交于 2019-12-19 02:46:47
JS获取计算机信息 使用js获取计算机信息需要以下条件: 使用IE浏览器(需要使用到只有IE浏览器有的ActiveX控件) 允许ActiveX控件的运行 用WMI(微软开放的API接口,供脚本语言使用) 示例代码(使用时替换properties的查询参数): <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Document</title> </head> <body> <script type="text/javascript"> var locator = new ActiveXObject ("WbemScripting.SWbemLocator"); var service = locator.ConnectServer("."); var properties = service.ExecQuery("SELECT * FROM Win32_UserAccount"); var e = new Enumerator (properties

clientX,offsetX,screenX,pageX 区别!

时光总嘲笑我的痴心妄想 提交于 2019-12-17 20:14:05
先总结下区别: event.clientX、event.clientY 鼠标相对于 浏览器 窗口可视区域的X,Y坐标(窗口坐标),可视区域不包括工具栏和滚动条。IE事件和标准事件都定义了这2个属性 event.pageX、event.pageY 类似于event.clientX、event.clientY,但它们使用的是文档坐标而非窗口坐标。这2个属性不是标准属性,但得到了广泛支持。IE事件中没有这2个属性。 event.offsetX、event.offsetY 鼠标相对于事件源元素(srcElement)的X,Y坐标,只有IE事件有这2个属性,标准事件没有对应的属性。 event.screenX、event.screenY 鼠标相对于用户显示器屏幕左上角的X,Y坐标。标准事件和IE事件都定义了这2个属性 上图!!!! 来源: https://www.cnblogs.com/tongbiao/p/6717724.html