摘要: <script language="javascript">/* len 为长度 *//*String.fromCharCode()函数将数字转换为对应ASCII码*//*Math.floor(x)函数对数进行下舍入*//*Math.ceil(x)函数对数进行上舍入*//*Math.round(x)函数对数进行四舍五入*//*Math.random()函数返回 0 ~ 1 之间的随机数*//*"a".charCodeAt(0)将字符转换成10进制的字符码*/function getPass(len){var tmpCh = "&qu 阅读全文
posted @ 2012-11-21 15:21 纯属偶然_黄勇 阅读(278) 评论(0) 推荐(0) 编辑
摘要: function loadXMLDoc(url){var xmlhttp;var txt,x,xx,i;if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); }else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); }xmlhttp.onreadystatechange=function() { if (xmlhttp.re 阅读全文
posted @ 2012-11-20 16:21 纯属偶然_黄勇 阅读(125) 评论(0) 推荐(0) 编辑
摘要: escape()编码,不能编码URIunescape()解码,不能编码URIencodeURIComponent()编码范围比encodeURI大些decodeURIComponent()解码范围比encodeURI大些encodeURI()对一个URI编码decodeURI()对一个URI解码isFininte()检测表达式的值,如果不是无穷大或NaN则为TrueisNaN()判断是否NaN 阅读全文
posted @ 2012-11-20 15:41 纯属偶然_黄勇 阅读(236) 评论(0) 推荐(0) 编辑
摘要: var mousewheelevt=(/Firefox/i.test(navigator.userAgent))?"DOMMouseScroll": "mousewheel"//FF doesn't recognize mousewheel as of FF3.x判断火狐浏览器,这个例子是判断是鼠标滚动轴的滚动事件。var isChrome = window.navigator.userAgent.indexOf("Chrome") !== -1 var isChrome = window.google && 阅读全文
posted @ 2012-11-19 16:10 纯属偶然_黄勇 阅读(140) 评论(0) 推荐(0) 编辑
摘要: 问题说明: Firefox下以图片为句柄的拖拽效果无法触发onmouseup事件,同样的在空的div中也也无法触发onmouseup事件,同时在所有浏览器下选中文字后div的mouseup事件失效;解决方法 : Firefox下Drag效果句柄不能作用在img元素上,解决有两种。 1、 用一个div层盖住img 2、 用非img元素作拖拽句柄 Firefox下空div无法拖拽可添加&nbsp;以帮助解决。但是在添加文字或空格后,又会在选中时影响onmouseup事件。 解决浏览器下选中文字导致onmouseup事件事件失效。 1.firefox下可添加*{-moz-user-sel.. 阅读全文
posted @ 2012-11-19 16:02 纯属偶然_黄勇 阅读(676) 评论(0) 推荐(0) 编辑
摘要: 来源:http://www.denisdeng.com/?p=685相信用户在浏览GoogleMap时,都注意到向上或向下滚动鼠标可以使地图放大或缩小。其实,对于鼠标滚动我们并不陌生。但要给一个元素绑定鼠标滚动事件,我们有必要对该事件有一个详尽的了解。浏览器对该事件支持情况如何?IE6,Opera9+,Safari2+以及Firefox1+均支持“onmousewheel”事件,在FF3.x中,与之相当的是“DOMMouseScroll”事件。“onmousewheel”作为事件名,不为其识别。所以,为了保证能在每个浏览器中都能运行,就需要针对不同的浏览器来绑定不同的事件。var mousew 阅读全文
posted @ 2012-11-14 16:16 纯属偶然_黄勇 阅读(6415) 评论(0) 推荐(0) 编辑
摘要: IE浏览器不管是什么版本,总是跟Web标准有些不太兼容。对于代码工作者来说,自然是苦不堪言,为了考虑IE的兼容问题,不管是写 CSS 还是 JS,往往都要对 IE 特别对待,这就少不了做些判断。本文不讨论如何区分 IE 的样式,仅是 JS 判定 IE 浏览器。 这个目前世界上最短的 Javascript 判定 IE 浏览器的方法来自俄罗斯!它已经在各版本的 IE 以及目前其他流行的浏览器上经过测试,基于 IE 的 Bug,微软虽然已经意识到,但是从来没有纠正过。<script type=’text/javascript’>var ie = !-[1,];alert(ie);< 阅读全文
posted @ 2012-11-14 16:08 纯属偶然_黄勇 阅读(312) 评论(0) 推荐(0) 编辑
摘要: <script type="text/javascript"><!-- function startSort(){ var a=document.getElementById('s').value; a=a.split(',') a.sort(); document.getElementById('r1').value=a; a.sort(function(a,b){return a.localeCompare(b)});//汉字拼音排序方法 document.getElemen... 阅读全文
posted @ 2012-10-30 12:11 纯属偶然_黄勇 阅读(8511) 评论(0) 推荐(1) 编辑
摘要: js判断ie61. 纯js的方法:var isIE6 = !-[1,] && !window.XMLHttpRequest;2. html注释方法<!--[if IE 6]> some codes... <![endif]-->3. jQuery方法if ($.browser.msie && (parseInt($.browser.version) <= 7)){some codes...} 阅读全文
posted @ 2012-10-19 17:35 纯属偶然_黄勇 阅读(139) 评论(0) 推荐(0) 编辑
摘要: var porssss=document.getElementById("brands_right").getElementsByTagName("p");for(var i=0;i<porssss.length;i++){porssss[i].style.top="140px";porssss[i].parentNode.onmouseover=function(){porssss_show(this,30);}porssss[i].parentNode.onmouseout=function(){porssss_show(t 阅读全文
posted @ 2012-08-29 18:54 纯属偶然_黄勇 阅读(249) 评论(0) 推荐(0) 编辑