代码改变世界

常用的jquery 表单代码

2013-02-18 10:46 by yangpan, 201 阅读, 0 推荐, 收藏, 编辑
摘要://选择被选中Radio的Value值$(“input[name='radio_name'][checked]“).val();//根据Value值设置Radio为选中状态$(“input[name='radio_name'][value='要选中Radio的Value值']“).attr(“checked”,true);//选择被选中CheckBox元素的集合 如果你想得到Value值你需要遍历这个集合$(“input[name='checkbox_name'][checked]“);//遍历被选中CheckBox元素的集合 得 阅读全文

css 中常见的bug(1)

2013-02-18 10:13 by yangpan, 209 阅读, 0 推荐, 收藏, 编辑
摘要:1.IE6中浮动元素3px间隔Bug:发生场合:发生在一个元素浮动,然后一个不浮动的元素自然上浮与之靠近会出现的3px的bug。解决方法:右边元素也一起浮动;或者为右边元素添加IE6 Hack _margin-left:-3px;从而消除3px间距。2.IE6/7负margin隐藏Bug:发生场合:当给一个有hasLayout的父元素内的非hasLayout元素设置负marin时,超出父元素部分不可见。解决方法:去掉父元素的hasLayout;或者赋hasLayout给子元素,并添加position:relative;IE6/7下ul/ol标记消失bug:发生场合:当ul/ol触发了hasla 阅读全文

去掉链接的边框

2013-01-15 09:27 by yangpan, 174 阅读, 0 推荐, 收藏, 编辑
摘要:1.ie下添加属性hidefocus="true"2.ff等浏览器 outline:none;3将以下代码保存为link.htc文件<public:attachevent="onfocus"onevent="hscfsy()"/><scripttype="text/javascript">function hscfsy(){this.blur();}</script>链接样式中加入:a { behavior:url(link.htc);} 阅读全文

js 实现jsop请求

2013-01-09 14:32 by yangpan, 446 阅读, 0 推荐, 收藏, 编辑
摘要:<!DOCTYPE HTML><html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> </head> <script> window.onload = function() { /*加载一个script*/ var getScript=function(url, callback) { var script = document.createEleme... 阅读全文

常用的代码

2013-01-08 15:39 by yangpan, 164 阅读, 0 推荐, 收藏, 编辑
摘要:Css Reset by Eric Meyerhtml,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr, 阅读全文

格式化文件大小

2013-01-07 09:45 by yangpan, 236 阅读, 0 推荐, 收藏, 编辑
摘要:formatFileSize: function (size, u) { u = u ? u : 0; var sizeUnit = ['B', 'KB', 'MB', 'GB', 'TB']; if (u < 0 || u >= sizeUnit.length) { return '0B'; }; if (size < 1) { return this.formatFileSize(size * 1024, --u); } else if (size < 1024) { r 阅读全文

在win7中安装xp虚拟机

2013-01-06 10:46 by yangpan, 344 阅读, 0 推荐, 收藏, 编辑
摘要:做为网站前台设计人员我们经常用到IETester,因为他可以帮助我们测试各个浏览器之间兼容情况我们可以及时进行DIV+CSS调整,所有浏览器中恐怕IE6最烦人的,但是它的用户群却不少,我们可能在用IETester测试IE6时,有时候发现它并不能完全模拟IE6环境是有差别的,如果安装一个xp虚拟机(Xp系统自带IE6)来测不就行了。但是你知道如何用WIN7自带的xp虚拟机嘛?不知道请看下面。1, 打开windows下载中心:http://www.microsoft.com/china/windows/virtual-pc/download.aspx下载:Windows XP Mode 和 Win 阅读全文

请url请求转化成obj

2013-01-04 15:21 by yangpan, 248 阅读, 0 推荐, 收藏, 编辑
摘要:var formatQuery=function(query){ var strs=query.split("&"); var theRequest = {}; for(var str in strs){ var p=strs[str].split("="); theRequest[p[0]] = !theRequest[p[0]] ? p[1] : theRequest[p[0]] + ',' + decodeURI(decodeURI(p[1] || '')).replace(/\+/g, ' ' 阅读全文

js实现format

2012-12-06 17:26 by yangpan, 752 阅读, 0 推荐, 收藏, 编辑
摘要:var stringFormat = function(tpl ,arr){ var newStr = tpl; for (var key in arr) { while (newStr.indexOf('{' +key+ '}') >= 0) { newStr = newStr.replace('{' + key+ '}',arr[key]); } }; return newStr;}; String.prototype.format=function() { var formatted = this; ... 阅读全文

不错的reset.css

2012-12-05 17:54 by yangpan, 172 阅读, 0 推荐, 收藏, 编辑
摘要:@charset "utf-8";/* ------------------------------------------------- * reset css * copyright: www.w3cplus.com * author: 为之 * -------------------------------------------------*/html{ height:100%; -webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; -webkit-font-smoothing:antialiased 阅读全文