【Firefox和Chrome拼性能,结果……】教程文章相关的互联网学习教程文章

js实现iframe框架取值的方法(兼容IE,firefox,chrome等)

本文实例讲述了js实现iframe框架取值的方法。分享给大家供大家参考,具体如下: 为啥世上会有这么多不同的浏览器?每次遇到js/css的浏览器兼容性问题,总是要发出这样的感叹,真希望这些个浏览器公司全部倒下,然后只留下一家(显然这是一个不可能实现的美好愿望),言归正传,看代码吧: iframe框架内页: <html> <head><title>框架内页</title> </head> <body><div><input id="txt1" name="txt1" type="text" value="测试" /></div>...

ZeroClipboard插件实现多浏览器复制功能(支持firefox、chrome、ie6)

但是值得注意的是官方介绍中已明确表态说这个插件不支持ie6,下面将提供多实例化Zero Clipboard复制功能的实现及兼容ie6的写法! 先下载ZeroClipboard //www.gxlcms.com/jiaoben/24961.html <style type="text/css">body { font-family:arial,sans-serif; font-size:9pt; }.copyit {text-align:center; border:1px solid #FD6001; background-color:#ED730B; margin:10px; padding:2px 5px; cursor:pointer; font-size:12px; border...

兼容最新firefox、chrome和IE的javascript图片预览实现代码【图】

javascript实现客户端file选择文件后img标签加载客户端图片实现图片预览。 测试浏览器:firefox6,firefox12,chrome 25.0.1364.172 m,IE6-IE10 都兼容 safari5.0.4不支持FileReader和file.files.item(0).getAsDataURL方法,暂时无解,需要上传到服务器后返回临时文件名用img标签加载,不知道后续的safari版本是否支持FileReader对象。 IE10下效果:IE9下效果:实现源代码: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transi...

兼容IE、firefox以及chrome的js获取时间(getFullYear)

一般情况下,我们获取年份的时候都是通过下面的代码: var now = new Date(); var initYear = now.getYear(); 以上代码在IE中initYear是对的,但是ff以及chrome下不兼容,换成 var initYear = now.getFullYear();IE、FireFox、Chrome下均可行 JS中getYear()和getFullYear()区别: js中得到当前年份做法是var dayObj=new Date(); dayObj.getYear()来得到年份,我前面写过这样会出现浏览器的兼容性的问题,就是在IE中能得到我们想要...

js 获取页面高度和宽度兼容 ie firefox chrome等

代码如下:<script> //得到页面高度 var yScroll = (document.documentElement.scrollHeight >document.documentElement.clientHeight) ? document.documentElement.scrollHeight : document.documentElement.clientHeight; alert(yScroll) //得到页面宽度 var xScroll=(document.documentElement.scrollWidth>document.documentElement.clientWidth) ? document.documentElement.scrollWidth : document.documentElement.scrollWid...

JavaScript加入收藏夹功能(兼容IE、firefox、chrome)

实现代码: 代码如下:<script>function addFav(){ if(document.all){ window.external.addFavorite(http://jb51.net,FREE Web Directory); }else if(window.sidebar){ window.sidebar.addPanel(FREE Web Directory, http://jb51.net,); }}</script><a href="http://jb51.net" title="FREE Web Directory" rel="sidebar" onclick="addFav();">加入收藏</a></div> javascript 加入收藏夹,需要注意一个细节的地方,如果...

自制的文件上传JS控件可支持IE、chrome、firefox etc

代码如下:(function() { if (window.FileUpload) { return; } window.FileUpload = function (id, url) { this.id = id; this.autoUpload = true; this.url = url; this.maxSize = null; this.extensions = null; this.dropId = null; }; window.FileUpload.prototype.init = function() { var obj = this; $(# + this.id).change(function () { if (obj.autoUpload) { obj.upload(); } }); if (this.supportsFormData()) { if (th...

在firefox和Chrome下关闭浏览器窗口无效的解决方法

首先IE是可以通过window.close()来关闭浏览器窗口的,但是在firefox和Chrome下是无效的。 原因在于: Firefox下默认设置是无法通过脚本来关闭浏览器窗口的,为的是防止恶意脚本注入, 所以调整的方式就是在url地址栏中输入about:config, 然后在配置列表中找到 dom.allow_scripts_to_close_windows 点右键的选切换把上面的false修改为true即可。 默认是false chrome下的默认是不支持这种关闭方式的,但是也可以通过一些特殊的手段进...

JavaScript的常见兼容问题及相关解决方法(chrome/IE/firefox)

首先这里声明一下,关于我测试浏览器的版本是chrome15.0.874.121 Firefox 8.01 IE9 IETester 下面的代码关于声明 1:获得滚动条的情况 代码如下:function getScroll(){ var t, l, w, h; if (document.documentElement && document.documentElement.scrollTop) { t = document.documentElement.scrollTop;//滚动条的顶端 l = document.documentElement.scrollLeft;//滚动条的左端 w...

JS控制图片翻转示例代码(兼容firefox,ie,chrome)

代码如下:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>图片旋转效果</title> <meta http-equiv="content-type" content="text/html;charset=gb2312"> <!--把下面代码加到<head>与</head>之间--> <style type="text/css"> ul{padding:0 15px;} ul li{padding-bottom:15px;border-bott...

javascript获取select的当前值示例代码(兼容IE/Firefox/Opera/Chrome)

JavaScript获取Select当前值写法:var value = document.getElementById("select").options[document.getElementById("select").options.selectedIndex].value;var text = document.getElementById("select").options[document.getElementById("select").options.selectedIndex].text; 例子: 代码如下:<script>function check() { var select = document.getElementById("select").options[document.getElementById("select"...

设为首页和收藏的Javascript代码(亲测兼容IE,Firefox,chrome等浏览器)

由于chrome,safari,opara 浏览器还未支持自动 "设为首页" & "加入收藏". 所以我们只能try, catch一下, 给个错误提示! 也算完美了. 另外ie中, 很多人也碰到过 它window.external.addFavorite. 时会报错的问题. 所以俺也只好抛出提示信息了. 加入收藏: 代码如下:function addFavorite(){ if (document.all){ try{ window.external.addFavorite(window.location.href,document.title); }catch(e){ ...

解析ScrollPic在ie8下只滚动一遍,然后变为空白 ie6,ie7,chrome,firefox正常

网上有很多说在<head>里加一句:<meta http-equiv="X-UA-Compatible" content="IE=7" />或者<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />就可以解决,实际测试根本没有效果,原来是在ScrollPic.js里有个cssFloat这个样式除ie外都支持就tmd ie不支持,解决方法改为styleFloat。这时会发现ie下正常了,但是其他浏览器却只滚动一次,解决思路,先用js判断浏览器类型,然后使用不同的样式:cssFloat或styleFloat。

javascript实现拖动层效果代码(符合标准且兼容IE,chrome,firefox)

实例代码一见: 代码如下:<!DOCTYPE HTML> <html> <head> <style type="text/css"> #main div{position:absolute;width:220px;height:150px;border:1px solid #999;} </style> <script type="text/javascript"> var a; document.onmouseup = function() { if (!a) return; a = ""; }; document.onmousemove = function(d) { if (!a) return; d=d||event; a.style.left = (d.clientX - b) + "px"; a.style.top = (d.clientY - c) +...

解决javascript:window.close()在chrome,Firefox下失效的问题【图】

window.close(),一看就知道是用来关闭浏览器窗口的方法。W3CSchool对该方法的解释如下:方法 close() 将关闭有 window 指定的顶层浏览器窗口。某个窗口可以通过调用 self.close() 或只调用 close() 来关闭其自身。只有通过 JavaScript 代码打开的窗口才能够由 JavaScript 代码关闭。这阻止了恶意的脚本终止用户的浏览器。 在IE中,window.close()能生效,在生效的时候,会弹出提示框,询问你是否关闭该窗口,如图: ...