摘要: var data="{ root: [ {name:'1',value:'0'}, {name:'6101',value:'北京市'}, {name:'6102',value:'天津市'} ] }"; 阅读全文
posted @ 2011-05-07 15:24 leamiko 阅读(143) 评论(0) 推荐(0)
摘要: test 阅读全文
posted @ 2011-05-07 15:16 leamiko 阅读(114) 评论(0) 推荐(0)
摘要: window.onerror=reportError;function reportError(msg,url,line) {var str = "You have found an error as below: \n\n";str += "Err: " + msg + " on line: " + line;alert(str);return true;} 阅读全文
posted @ 2011-05-07 14:29 leamiko 阅读(154) 评论(0) 推荐(0)
摘要: 由于Ajax的兴起,JSON这种轻量级的数据格式作为客户端与服务器之间的传输格式逐渐地流行起来,进而出现的问题是如何将服务器端构建好的JSON数据转化为可用的JavaScript对象。利用eval函数无疑是一种简单而直接的方法。在转化的时候需要将JSON字符串的外面包装一层圆括号:var jsonObject = eval("(" + jsonFormat + ")");为什么要加括号?加上圆括号的目的是迫使eval函数在处理JavaScript代码的时候强制将括号内的表达式(expression)转化为对象,而不是作为语句(statement)来执行。 阅读全文
posted @ 2011-05-07 14:24 leamiko 阅读(1655) 评论(0) 推荐(1)
document.getElementById('MySignature') && document.getElementById('MySignature').style.display = "none"; document.getElementById('MySignature') && document.getElementById('blog_post_info').style.display = "none";