我在<<javascript遍历DOM结构和对象结构>>一文中提供了一个遍历对象结构的函数,利用这个函数,展现IE10中window对象的结构(还真是不少啊~调试代码也在呢~)如下:
调试信息:
[Object] window
|--[function] addEventListener = function addEventListener() { [native code] }
|--[function] alert = function alert() { [native code] }
|--[number] animationStartTime = 7011862239376.545
|--[object] applicationCache
|--[function] atob = function atob() { [native code] }
|--[function] attachEvent = function attachEvent() { [native code] }
|--[function] blur = function blur() { [native code] }
|--[function] btoa = function btoa() { [native code] }
|--[function] cancelAnimationFrame = function cancelAnimationFrame() { [native code] }
|--[function] clearDbgInfo = function clearDbgInfo(){ document.getElementById("dbg").innerHTML=""; }
|--[function] clearImmediate = function clearImmediate() { [native code] }
|--[function] clearInterval = function clearInterval() { [native code] }
|--[function] clearTimeout = function clearTimeout() { [native code] }
|--[object] clientInformation
|--[object] clipboardData
|--[function] close = function close() { [native code] }
|--[boolean] closed = false
|--[function] confirm = function confirm() { [native code] }
|--[object] console
|--[function] createPopup = function createPopup() { [native code] }
|--[string] defaultStatus =
|--[function] detachEvent = function detachEvent() { [native code] }
|--[function] dispatchEvent = function dispatchEvent() { [native code] }
|--[object] document
|--[object] event
|--[function] execScript = function execScript() { [native code] }
|--[object] external
|--[function] focus = function focus() { [native code] }
|--[object] frameElement
|--[object] frames
|--[function] getComputedStyle = function getComputedStyle() { [native code] }
|--[function] getSelection = function getSelection() { [native code] }
|--[object] history
|--[undefined] indexedDB = undefined
|--[number] innerHeight = 519
|--[number] innerWidth = 1143
|--[function] item = function item() { [native code] }
|--[number] length = 0
|--[undefined] localStorage = undefined
|--[object] location
|--[function] matchMedia = function matchMedia() { [native code] }
|--[number] maxConnectionsPerServer = 10
|--[function] moveBy = function moveBy() { [native code] }
|--[function] moveTo = function moveTo() { [native code] }
|--[number] msAnimationStartTime = 7011862239376.545
|--[function] msCancelRequestAnimationFrame = function msCancelRequestAnimationFrame() { [native code] }
|--[function] msClearImmediate = function msClearImmediate() { [native code] }
|--[undefined] msIndexedDB = undefined
|--[function] msIsStaticHTML = function msIsStaticHTML() { [native code] }
|--[function] msMatchMedia = function msMatchMedia() { [native code] }
|--[function] msRequestAnimationFrame = function msRequestAnimationFrame() { [native code] }
|--[function] msSetImmediate = function msSetImmediate() { [native code] }
|--[function] msWriteProfilerMark = function msWriteProfilerMark() { [native code] }
|--[string] name =
|--[function] navigate = function navigate() { [native code] }
|--[object] navigator
|--[string] offscreenBuffering = auto
|--[object] onabort
|--[object] onafterprint
|--[object] onbeforeprint
|--[object] onbeforeunload
|--[object] onblur
|--[object] oncanplay
|--[object] oncanplaythrough
|--[object] onchange
|--[object] onclick
|--[object] oncontextmenu
|--[object] ondblclick
|--[object] ondrag
|--[object] ondragend
|--[object] ondragenter
|--[object] ondragleave
|--[object] ondragover
|--[object] ondragstart
|--[object] ondrop
|--[object] ondurationchange
|--[object] onemptied
|--[object] onended
|--[object] onerror
|--[object] onfocus
|--[object] onfocusin
|--[object] onfocusout
|--[object] onhashchange
|--[object] onhelp
|--[object] oninput
|--[object] onkeydown
|--[object] onkeypress
|--[object] onkeyup
|--[object] onload
|--[object] onloadeddata
|--[object] onloadedmetadata
|--[object] onloadstart
|--[object] onmessage
|--[object] onmousedown
|--[object] onmouseenter
|--[object] onmouseleave
|--[object] onmousemove
|--[object] onmouseout
|--[object] onmouseover
|--[object] onmouseup
|--[object] onmousewheel
|--[object] onmsgesturechange
|--[object] onmsgesturedoubletap
|--[object] onmsgestureend
|--[object] onmsgesturehold
|--[object] onmsgesturestart
|--[object] onmsgesturetap
|--[object] onmsinertiastart
|--[object] onmspointercancel
|--[object] onmspointerdown
|--[object] onmspointerhover
|--[object] onmspointermove
|--[object] onmspointerout
|--[object] onmspointerover
|--[object] onmspointerup
|--[object] onoffline
|--[object] ononline
|--[object] onpause
|--[object] onplay
|--[object] onplaying
|--[object] onpopstate
|--[object] onprogress
|--[object] onratechange
|--[object] onreadystatechange
|--[object] onreset
|--[object] onresize
|--[object] onscroll
|--[object] onseeked
|--[object] onseeking
|--[object] onselect
|--[object] onstalled
|--[object] onstorage
|--[object] onsubmit
|--[object] onsuspend
|--[object] ontimeupdate
|--[object] onunload
|--[object] onvolumechange
|--[object] onwaiting
|--[function] open = function open() { [native code] }
|--[undefined] opener = undefined
|--[number] outerHeight = 617
|--[number] outerWidth = 1149
|--[number] pageXOffset = 0
|--[number] pageYOffset = 0
|--[object] parent
|--[object] performance
|--[function] postMessage = function postMessage() { [native code] }
|--[function] print = function print() { [native code] }
|--[function] prompt = function prompt() { [native code] }
|--[function] pt = function pt(myExp){ document.getElementById("dbg").innerHTML+="
"+myExp+" "+eval(myExp)+""; }
|--[function] put = function put(myStr){ document.getElementById("dbg").innerHTML+="
"+myStr+""; }
|--[function] removeEventListener = function removeEventListener() { [native code] }
|--[function] requestAnimationFrame = function requestAnimationFrame() { [native code] }
|--[function] resizeBy = function resizeBy() { [native code] }
|--[function] resizeTo = function resizeTo() { [native code] }
|--[object] screen
|--[number] screenLeft = 0
|--[number] screenTop = 79
|--[number] screenX = -3
|--[number] screenY = -3
|--[function] scroll = function scroll() { [native code] }
|--[function] scrollBy = function scrollBy() { [native code] }
|--[function] scrollTo = function scrollTo() { [native code] }
|--[object] self
|--[undefined] sessionStorage = undefined
|--[function] setImmediate = function setImmediate() { [native code] }
|--[function] setInterval = function setInterval() { [native code] }
|--[function] setTimeout = function setTimeout() { [native code] }
|--[function] showHelp = function showHelp() { [native code] }
|--[function] showModalDialog = function showModalDialog() { [native code] }
|--[function] showModelessDialog = function showModelessDialog() { [native code] }
|--[function] showObject = function showObject(myObjectName){ var myObject = eval(myObjectName); var objArray = new Array(); // 存储对象成员名称 var typename = null; //存储对象成员类型 try { // 将对象成员放入数组 for(var tmpObj in myObject) { if((myObject.hasOwnProperty && myObject.hasOwnProperty(tmpObj))||!(tmpObj==="undefined")){ objArray[objArray.length++] = tmpObj; } } put("");//输出,美化 put("[Object] "+myObjectName+"");//输出 if(objArray.length===0) { put("对象没有成员");//输出 return; } //对数组进行排序 objArray.sort(); for(var k=0;k"+objArray[k]+"");//输出 } else { put(" |--["+typename+"] "+objArray[k]+" = "+myObject[objArray[k]]);//输出 } } } catch (e) { alert("输入的不是对象"); } }
|--[string] status =
|--[object] styleMedia
|--[function] toStaticHTML = function toStaticHTML() { [native code] }
|--[function] toString = function toString() { [native code] }
|--[object] top
|--[object] window
本文转自 hexiaini235 51CTO博客,原文链接:http://blog.51cto.com/idata/1103417,如需转载请自行联系原作者