1:从一个界面跳转到其他界面
window.location.href="b.html"
2:判断变量是否为空
typeof obj == 'undefined' || obj == null || obj == ""
3:html引用公用的css和js
commonCss.js
document.write( '' );
commonJs.js
document.write( '' );
4:js操作json
//json字符串 var jsonstr ='{ "name": "cxh", "sex": "man" }'; //将Str转化为JSON var jsonobject = JSON.parse(jsonstr); console.log(jsonobject); for(var key in jsonobject){ console.log(key,jsonobject[key]); } //将json转换成str console.log(JSON.stringify(jsonobject));