原文 JS获取当前对象大小以及屏幕分辨率等 <script type="text/javascript">function getInfo(){ var s = ""; s += " 网页可见区域宽:"+ document.body.clientWidth+"\n"; s += " 网页可见区域高:"+ document.body.clien
for(i in pstrWord ){ alert(i); //获得属性 alert(pstrWord[i]); //获得属性值 } 1.js输出object对象方法如下: function writeObj(obj){ var description = ""; for(var i in obj){ var property=obj[i]; description+=i+" = "+property+"\n"; } console
/** * 获取时间对象 */function getDateObj(addDayCount) { var dd = new Date(); dd.setDate(dd.getDate()+addDayCount);//获取addDayCount天后的日期 var y = dd.getFullYear(); var m = dd.getMonth()+1;//获取当前月份的日期 var d = dd.getDate(); var h = dd.getHours(); var M = dd.get
Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--> <script type="text/javascript">function getInfo(){ var s = ""; s += " 网页可见区域宽:"+ document.body.clientWidth+"\n&q
1.当前系统时间 var date=new Date(); 2.字符串转时间对象 var date=new Date("2018-01-01"); 3.获取年份: var year=date.getFullYear(); 4.获取月份: var month=date.getMonth()+1; 5.获取天数: var day=date.getDate(); 6.获取小时:var hours=date.getHours(); 7.获取分钟:var minutes=date.getM
<script type="text/javascript"> getJson('age'); function getJson(key){ var jsonObj={"name":"傅红雪","age":"24","profession":"刺客"}; //1.使用eval方法 var eValue=eval('jsonObj.'+key); alert