2012年8月31日

c#遍历枚举中的项

摘要: Type type = typeof(enumTest); foreach (FieldInfo x in type.GetFields(BindingFlags.Public | BindingFlags.Static)) { enumTest item = (enumTest)x.GetValue(null); }思路:遍历枚举的公共且静态的Field,获取Field的值;然后将值强制转为枚举类型。 阅读全文

posted @ 2012-08-31 09:49 ayao 阅读(844) 评论(0) 推荐(0)

2012年6月25日

一个用jQuery写的函数,用于实现JSON.stringify

摘要: function jsonToStr(json) { var s = ""; $.each(json,function(i,n){ s+= "," + i + ":" + n; }); if(s != "") { s = s.substring(1); } return "{" + s + "}"; }JSO... 阅读全文

posted @ 2012-06-25 17:17 ayao 阅读(5882) 评论(1) 推荐(0)

2012年3月23日

常用css笔记

摘要: css透明度,多浏览器兼容div.transp { /* make the div translucent */ opacity: 0.6; /* Firefox, Safari(WebKit), Opera) */ filter: "alpha(opacity=60)"; /* IE 8 */ filter: alpha(opacity=60); /* IE 4-7 */ zoom: 1; /* needed in IE up to version 7, or set width or height to trigger "hasLayout" */ 阅读全文

posted @ 2012-03-23 09:29 ayao 阅读(164) 评论(0) 推荐(0)

2012年3月15日

javascript获取iframe框架中加载的页面document对象

摘要: javascript获取iframe框架中,加载的页面document对象因为浏览器安全限制,对跨域访问的页面,其document对象无法读取、设置属性 function getDocument(iframe) { var Doc; try{ Doc = iframe.contentWindow.document;// For IE5.5 and IE6 } catch(ex){} if(!Doc) { Doc = iframe.contentDocument;// For NS6 } return Doc; } 阅读全文

posted @ 2012-03-15 14:00 ayao 阅读(3404) 评论(0) 推荐(0)

2012年3月1日

javascript访问json数据简单入门例子

摘要: <html><head> <title>javascript访问json数据简单入门例子</title></head><body> <script type="text/javascript"> var json; window.onload = function() { //初始化字符串格式的json数据 var s = "[{name:'张三',sex:'男'},{name:'李四',sex:'女'}]" 阅读全文

posted @ 2012-03-01 16:49 ayao 阅读(499) 评论(0) 推荐(0)

导航