jquery
共 26 篇文章
jquery多函数执行
1、Array.prototype.slice.apply(arguments,[0/1/2])函数,截取调用函数传来的参数,[0],所有,[1],返回 222,33,55。 [2]返回,33,55 <script type="text/javascript"> function test(){ //将参数转为一个数组 var args = Array.prototype.slice.apply(arguments,[1]); //alert(args); } test(11,222,33,55); </script> 2、Function.apply(obj,args)函数, obj:这个…
2014-01-07 15:33 · jquery
js关闭浏览器兼容性问题
1、ie,chrome下面代码都可以 window.open('','_self',''); window.close(); 2、firefox要手动设置 1.在Firefox地址栏里输入 about:config 2.在配置列表中找到 dom.allow_scripts_to_close_windows 3.点右键的选切换把上面的false修改为true即可。 注:默认是false,是为了防止脚本乱关窗口 FireFox中做如此设置以后,直接使用“ window.close() ”即可对窗口关闭。
2013-09-13 10:23 · jquery
jquery弹框插件(自定义easy-box)
1、插件代码easy-box.js $.extend({ alert:function(title,msg,width){ var box_html = getPopBoxHtml('alert',title,msg,''); showBoxDiv(box_html,width); }, confirm:function(title,msg,callback,width){ var box_html = getPopBoxHtml('confirm',title,msg,callback); showBoxDiv(box_html,width); $('#box_ok_btn').click…
2013-08-30 14:39 · jquery
50个jQuery代码段帮你成为更出色的JS开发者
0. 如何创建嵌套的过滤器: //允许你减少集合中的匹配元素的过滤器, //只剩下那些与给定的选择器匹配的部分。在这种情况下, //查询删除了任何没(:not)有(:has) //包含class为“selected”(.selected)的子节点。 .filter(":not(:has(.selected))") 1. 如何重用元素搜索 var allItems = $("div.item"); var keepList = $("div#container1 div.item"); //现在你可以继续使用这些jQuery对象来工作了。例如, //基于复选框裁剪“keep list”,复选框…
2013-08-29 15:06 · jquery
jquery验证插件进一步进行封装(easy-check)
1、easy-check.js,核心代码如下(要运行demo或有什么问题,可以留言) var easyCheck; var defaultOptions = { showClass:'show_validate_div', //提示信息显示容器class parentTag:'tr', //输入框和提示信息共同父类标签 successImage:'./right.gif', //验证成功提示图片路径 ErrorImage:'./error.gif', //验证失败提示图片路径 imageHeight:23, //提示图片高度 imageWidth:23, //提示图片宽带 autoAjax:…
2013-07-29 14:48 · jquery
php echo jquery代码
话不多少,直接贴上代码 echo "<script type='text/javascript' src='/test/jquery.min.js'></script> <script type='text/javascript'> $('#viewImage',parent.document).append('<img src=".$viewUrl.">') </script>";
2013-07-09 11:30 · jquery
用户图上传从本地加载图片,兼容ie6+,chrome,firefox
直接上代码 写道 <!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> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>本地图片预览</title> <style type="text/css"> …
2012-11-24 17:26 · jquery
既可输入也可以选择的(input+select)兼容ie6+,chrome,firefox
直接上代码 <html> <head> <title>TW之运行代码插件--Ayin增强版</title> <style type="text/css"> div,span,p,td,font{font-size:9pt;} </style> </head> <body> <span style="absolute;margin-top:-12px;"> <table cellspacing="0" cellpadding="0" width="100%" border="0"><tr><td align="left"> <span style="position:absolute;bord…
2012-11-24 17:25 · jquery
js或jquery导致ie6下,gif卡帧(不动)
IE6下当JS触发GIF格式图片时,经常会出现GIF图片动几下便卡住不动或根本不动的情况,此种情况是由于JS导致,解决办法很简单,在onclick事件后加一句 return false; 即可。 <a href="javascript:void(0)" onclick="a.display='block';return false;" > 点我后GIF不动 </a>
2012-11-21 14:01 · jquery
js解决IE遮罩层无法遮罩select
1、包含js (function(a){a.fn.bgiframe=(a.browser.msie&&/msie 6\.0/i.test(navigator.userAgent)?function(d){d=a.extend({top:"auto",left:"auto",width:"auto",height:"auto",opacity:true,src:"javascript:false;"},d);var c='<iframe class="bgiframe"frameborder="0"tabindex="-1"src="'+d.src+'"style="display:block…
2012-11-07 15:23 · jquery
div固定顶部或底部,IE下postion:fixed问题
像你所遇到的问题一样, IE6浏览器有太多的bug让制作网页的人头疼。这篇文章介绍的是介绍的是如何解决IE6不支持position:fixed;属性的办法。如果我们需要做某个元素始终位于浏览器的底部,不会因为浏览器窗口的缩放和滚动条的滚动而变化,那个肯定是想到的用position:fixed生成绝对定位,只要设置这个CSS属性就能达到刚刚的需求。当其他浏览器都正常显示的时候,只有IE6不那么完美。该元素的位置是通过"left", "top", "right" 以及 "bottom" 属性进行规定。 一般的 position:fixed; 实现方法 以我的博客为例,在右下角 <div id="…
2012-11-07 14:14 · jquery
公告连续滚动js
<!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> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>多行滚动jQuery循环新闻列表代码</title> <style type="text/css…
2012-11-05 13:46 · jquery
jquery获取各种高度
alert($(window).height()); //浏览器时下窗口可视区域高度 alert($(document).height()); //浏览器时下窗口文档的高度 alert($(document.body).height());//浏览器时下窗口文档body的高度 alert($(document.body).outerHeight(true));//浏览器时下窗口文档body的总高度 包括border padding margin alert($(window).width()); //浏览器时下窗口可视区域宽度 alert($(document).width());//浏览器…
2012-09-19 20:57 · jquery
ie6下js的onmouseover和onmouseout事件连续触发问题的解决方法
解决HTML内部元素的Mouse事件干扰 话说有一个DIV元素,其内部有一个IMG元素和SPAN元素,不用理会这两个内部元素怎么布局,这不是我要讨论的重点。 为了实现一些特殊的效果,我需要利用TD的onmouseover和onmouseout事件,测试时就会发现如下的状况: 当鼠标移入DIV内部时,onmouseover事件被触发;接着再鼠标移动到DIV内部的IMG或者SPAN元素之上,我们肯定不会认为这时鼠标已经移到了DIV的外边,但奇怪的是onmouseout事件触发了,而且紧接着onmouseover事件也马上被触发了。 这可不是我想要的,那么怎么来“屏蔽”内部元素给外层元素带来的Ja…
2012-09-17 11:23 · jquery
jquery设置select选中,获取select选中的值 和文本
选中select选项,根据value var pid = $('#province').attr('pid'); $("#province option[value="+pid+"]").attr("selected",true); 获取select选中的值和文本 $("#select1 option:selected").val(); $("#select1 option:selected").text();
2012-09-11 17:03 · jquery
jquery图片剪切(插件)
我用过的jquery图片剪切插件有jcrop, imgselectarea 。都是最近工作需要才学的,图片剪切插件很多,觉得这两款,比较轻量级。 1、jcrop,imgSelectArea两款插件功能都差不多 2、jcrop,剪切gif在ie6有个bug,不断的闪屏 3.经过我的测试imgSelectArea各种类型图片,各种浏览器,都还是比较兼容。
2012-09-09 12:28 · jquery
jquery图片左右滚动,代码很简洁
<!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> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>超级经典一套鼠标控制左右滚动图片带自动翻滚</title> </head> <body> <di…
2012-09-03 17:46 · jquery
jquery 监听input输入值事件
<html> <head> <title></title> <script type="text/javascript" src="http://code.jquery.com/jquery-1.6.2.min.js"></script> </head> <script type="text/javascript"> $(function(){ //IE if($.browser.msie){ $("#sno").get(0).attachEvent("onpropertychange",function (o){ alert(o.srcElement.value); }); //非IE }…
2012-08-22 17:24 · jquery
jquery 可扩展滚动移动demo
<!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> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>多行滚动jQuery循环新闻列表代码</title> <style type="text/css…
2012-08-06 22:53 · jquery
jquery 设置select选中
jquery代码 $(document).ready(function (){ var sid = $('#sport_type_id').attr('sid'); var auth = $('#auth').attr('auth'); $("#sport_type_id option[value="+sid+"]").attr("selected",true); $("#auth option[value="+auth+"]").attr("selected",true); }); html代码 <div> 权限:<select name='auth' id="auth" auth="<{…
2012-08-02 10:01 · jquery