xiaophper.com
域名年龄: 14年10个月HTTP/1.1 200 OK 连接:关闭 访问时间:2013年11月02日 17:51:03 服务器:Microsoft-IIS/6.0 语言环境:ASP.NET 语言环境:PHP/5.2.17 X-Pingback: http://xphper.com/xmlrpc.php 类型:text/html; charset=UTF-8 网站编码:UTF-8
小小程序员做一个快乐的PHP开发者搜索主菜单跳至主内容区域跳至副内容区域首页关于本站文章导航← 早期文章26个Jquery使用小技巧发表于 2013年07月16日 由 大宇回复1. 禁止右键点击?View Code JAVASCRIPT$(document).ready(function(){$(document).bind("contextmenu",function(e){return false;});});2. 隐藏搜索文本框文字Hide when clicked in the search field, the value.(example can be found below in the comment fields)?View Code JAVASCRIPT$(document).ready(function() {$("input.text1").val("Enter your search text here");textFill($('input.text1'));});function textFill(input){ //input focus text functionvar originalvalue = input.val();input.focus( function(){if( $.trim(input.val()) == originalvalue ){ input.val(''); }});input.blur( function(){if( $.trim(input.val()) == '' ){ input.val(originalvalue); }});} 3. 在新窗口中打开链接XHTML 1.0 Strict doesn’t allow this attribute in the code, so use this to keep the code valid.?View Code JAVASCRIPT$(document).ready(function() {//Example 1: Every link will open in a new window$('a[href^="http://"]').attr("target", "_blank");//Example 2: Links with the rel="external" attribute will only open in a new window$('a[@rel$='external']').click(function(){this.target = "_blank";});});// how to use<A href="http://www.opensourcehunter.com" rel="external">open link</A> 4. 检测浏览器注: 在版本jQuery 1.4中,$.support 替换掉了$.browser 变量?View Code JAVASCRIPT$(document).ready(function() {// Target Firefox 2 and aboveif ($.browser.mozilla && $.browser.version >= "1.8" ){// do something}// Target Safariif( $.browser.safari ){// do something}// Target Chromeif( $.browser.chrome){// do something}// Target Caminoif( $.browser.camino){// do something}// Target Operaif( $.browser.opera){// do something}// Target IE6 and belowif ($.browser.msie && $.browser.version <= 6 ){// do something}// Target anything above IE6if ($.browser.msie && $.browser.version > 6){// do something}}); 5. 预加载图片This piece of code will prevent the loading of all images, which can be useful if you have a site with lots of images.?View Code JAVASCRIPT$(document).ready(function() {jQuery.preloadImages = function(){for(var i = 0; i<ARGUMENTS.LENGTH; jQuery(?<img { i++)>").attr("src", arguments[i]);}}// how to use$.preloadImages("image1.jpg");});6. 页面样式切换?View Code JAVASCRIPT$(document).ready(
© 2010 - 2020 网站综合信息查询 同IP网站查询 相关类似网站查询 网站备案查询网站地图 最新查询 最近更新 优秀网站 热门网站 全部网站 同IP查询 备案查询
2025-05-12 17:28, Process in 0.0101 second.