对javascript基本对象的属性以及方法的实例介绍 时间:2020-05-11 人气:0 文档(DOM)对象 <script language="JavaScript"> var newWin; function window_onLoad() { var nF=document.navigatorForm; nF.textfield.value=navigator.appCodeName; nF.textfield2.value=navigator.appName; nF.textfield3.value=navigator.appVersion; nF.textfield4.value=navigator.platform; nF.textfield5.value=navigator.userAgent; nF.textfield6.value=navigator.javaEnabled(); var sF=document.screenForm; sF.textfield7.value=screen.width; sF.textfield8.value=screen.height; sF.textfield9.value=screen.availWidth; sF.textfield10.value=screen.availHeight; sF.textfield11.value=screen.colorDepth; var wF=document.windowForm; wF.textfield12.value=window.name; window.status="你好"; wF.textfield13.value=window.status; wF.textfield14.value=window.opener; wF.textfield15.value=window.self; wF.textfield16.value=window.parent; wF.textfield17.value=window.top; var hF=document.historyForm; hF.textfield18.value=history.length; var dF=document.documentForm; dF.textfield19.value=document.lastModified; dF.textfield20.value=document.referrer; dF.textfield21.value=document.title; } function opennewWin(url) { newWin=window.open(url,"win","scrollbars=yes,location=yes,width=500,height=300,resizable=yes,left=100,top=100"); window.focus(); window.scrollTo(100,100); } </script> navigaton 属性: appCodeName(浏览器码名): appName(浏览器名): appVersion(浏览器版本号): platform(浏览器操作平台): userAgent(浏览器全部信息): javaEnabled(检测当前浏览器是否允许Java): screen 属性: width(宽度): height(高度): availWidth(可用宽度): availHeight(可用高度): colorDepth(颜色位数): window 属性: name(窗口标题): status(状态栏): opener(父窗口): self(返回的就是window自身): parent(返回所属框架页对象): top(返回整个窗口占据最顶端的框架页对象): history:见下 location:见下 documnet:见下 方法: history length: document lastModified: referrer: title: [Ctrl+A 全选 注:如需引入外部Js需刷新才能执行] 加载全部内容