js中的window.scroll与 window.scrollTo 两者是啥关系, 有啥区别?

吉普赛的歌 社区高级成员 T9 2013-11-01 11:35:47
看了下 w3cschool, http://www.w3school.com.cn/htmldom/dom_obj_window.asp

但根本找不到 window.scroll ……

但 VS 中确实可以智能提示 window.scroll 的, 而且页面也能用, 
请哪位给点参考……
...全文
1218 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
吉普赛的歌 社区高级成员 T9 2013-11-08
  • 打赏
  • 举报
回复
算了, 结贴吧
KK3K2005 2013-11-01
  • 打赏
  • 举报
回复
https://developer.mozilla.org/en-US/docs/Web/API/Window.scroll
  • 打赏
  • 举报
回复
scroll应该是jquery里面的吧 jquery.scroll()
吉普赛的歌 社区高级成员 T9 2013-11-01
  • 打赏
  • 举报
回复
引用 7 楼 u011461314 的回复:
楼主有空,教教我怎么看源代码。
晕, 哥也是菜鸟啊
zhjdg 2013-11-01
  • 打赏
  • 举报
回复
楼主有空,教教我怎么看源代码。
吉普赛的歌 社区高级成员 T9 2013-11-01
  • 打赏
  • 举报
回复
引用 5 楼 KK3K2005 的回复:
[quote=引用 3 楼 yenange 的回复:] [quote=引用 2 楼 KK3K2005 的回复:] https://developer.mozilla.org/en-US/docs/Web/API/Window.scroll
也只是说明了有 window.scroll 这个东西, 但两者的区别呢?[/quote] 见 4L说的 类似问题了解下即可 没深究必要[/quote] 非常感谢你为我提供了这么好一个网站让我参考,但人家创造一个东西总归有他的用处的, 不可能说已经有了还做重复的。 程序界里重复轮子的事情是非常少的…… 比如 substr 和 substring 你觉得是同一个东西吗?
KK3K2005 2013-11-01
  • 打赏
  • 举报
回复
引用 3 楼 yenange 的回复:
[quote=引用 2 楼 KK3K2005 的回复:] https://developer.mozilla.org/en-US/docs/Web/API/Window.scroll
也只是说明了有 window.scroll 这个东西, 但两者的区别呢?[/quote] 见 4L说的 类似问题了解下即可 没深究必要
阿鱼 2013-11-01
  • 打赏
  • 举报
回复
引用 3 楼 yenange 的回复:
[quote=引用 2 楼 KK3K2005 的回复:] https://developer.mozilla.org/en-US/docs/Web/API/Window.scroll
也只是说明了有 window.scroll 这个东西, 但两者的区别呢?[/quote] 没有区别 2楼给的链接关于window.scroll的文档里面,最下面有一行: “window.scrollTo is effectively the same as this method.....”
吉普赛的歌 社区高级成员 T9 2013-11-01
  • 打赏
  • 举报
回复
引用 2 楼 KK3K2005 的回复:
https://developer.mozilla.org/en-US/docs/Web/API/Window.scroll
也只是说明了有 window.scroll 这个东西, 但两者的区别呢?
JavaScript权威指南 犀牛书 Chapter 1. Introduction to JavaScript Section 1.1. JavaScript Myths Section 1.2. Versions of JavaScript Section 1.3. Client-Side JavaScript Section 1.4. JavaScript in Other Contexts Section 1.5. Client-Side JavaScript: Executable Content in Web Pages Section 1.6. Client-Side JavaScript Features Section 1.7. JavaScript Security Section 1.8. Example: Computing Loan Payments with JavaScript Section 1.9. Using the Rest of This Book Section 1.10. Exploring JavaScript Part I: Core JavaScript Chapter 2. Lexical Structure Section 2.1. Character Set Section 2.2. Case Sensitivity Section 2.3. Whitespace and Line Breaks Section 2.4. Optional Semicolons Section 2.5. Comments Section 2.6. Literals Section 2.7. Identifiers Section 2.8. Reserved Words Chapter 3. Data Types and Values Section 3.1. Numbers Section 3.2. Strings Section 3.3. Boolean Values Section 3.4. Functions Section 3.5. Objects Section 3.6. Arrays Section 3.7. null Section 3.8. undefined Section 3.9. The Date Object Section 3.10. Regular Expressions Section 3.11. Error Objects Section 3.12. Primitive Data Type Wrapper Objects Chapter 4. Variables Section 4.1. Variable Typing Section 4.2. Variable Declaration Section 4.3. Variable Scope Section 4.4. Primitive Types and Reference Types Section 4.5. Garbage Collection Section 4.6. Variables as Properties Section 4.7. Variable Scope Revisited Chapter 5. Expressions and Operators Section 5.1. Expressions Section 5.2. Operator Overview Section 5.3. Arithmetic Operators Section 5.4. Equality Operators Section 5.5. Relational Operators Section 5.6. String Operators Section 5.7. Logical Operators Section 5.8. Bitwise Operators Section 5.9. Assignment Operators Section 5.10. Miscellaneous Operators Chapter 6. Statements Section 6.1. Expression Statements Section 6.2. Compound Statements Section 6.3. if Section 6.4. else if Section 6.5. switch Section 6.6. while Section 6.7. do/while Section 6.8. for Section 6.9. for/in Section 6.10. Labels Section 6.11. break Section 6.12. continue Section 6.13. var Section 6.14. function Section 6.15. return Section 6.16. throw Section 6.17. try/catch/finally Section 6.18. with Section 6.19. The Empty Statement Section 6.20. Summary of JavaScript Statements Chapter 7. Functions Section 7.1. Defining and Invoking Functions Section 7.2. Functions as Data Section 7.3. Function Scope: The Call Object Section 7.4. Function Arguments: The Arguments Object Section 7.5. Function Properties and Methods Chapter 8. Objects Section 8.1. Objects and Properties Section 8.2. Constructors Section 8.3. Methods Section 8.4. Prototypes and Inheritance Section 8.5. Object-Oriented JavaScript Section 8.6. Objects as Associative Arrays Section 8.7. Object Properties and Methods Chapter 9. Arrays Section 9.1. Arrays and Array Elements Section 9.2. Array Methods Chapter 10. Pattern Matching with Regular Expressions Section 10.1. Defining Regular Expressions Section 10.2. String Methods for Pattern Matching Section 10.3. The RegExp Object Chapter 11. Further Topics in JavaScript Section 11.1. Data Type Conversion Section 11.2. By Value Versus by Reference Section 11.3. Garbage Collection Section 11.4. Lexical Scoping and Nested Functions Section 11.5. The Function( ) Constructor and Function Literals Section 11.6. Netscape's JavaScript 1.2 Incompatibilities Part II: Client-Side JavaScript Chapter 12. JavaScript in Web Browsers Section 12.1. The Web Browser Environment Section 12.2. Embedding JavaScript in HTML Section 12.3. Execution of JavaScript Programs Chapter 13. Windows and Frames Section 13.1. Window Overview Section 13.2. Simple Dialog Boxes Section 13.3. The Status Line Section 13.4. Timeouts and Intervals Section 13.5. Error Handling Section 13.6. The Navigator Object Section 13.7. The Screen Object Section 13.8. Window Control Methods Section 13.9. The Location Object Section 13.10. The History Object Section 13.11. Multiple Windows and Frames Chapter 14. The Document Object Section 14.1. Document Overview Section 14.2. Dynamically Generated Documents Section 14.3. Document Color Properties Section 14.4. Document Information Properties Section 14.5. Forms Section 14.6. Images Section 14.7. Links Section 14.8. Anchors Section 14.9. Applets Section 14.10. Embedded Data Chapter 15. Forms and Form Elements Section 15.1. The Form Object Section 15.2. Defining Form Elements Section 15.3. Scripting Form Elements Section 15.4. Form Verification Example Chapter 16. Scripting Cookies Section 16.1. An Overview of Cookies Section 16.2. Storing Cookies Section 16.3. Reading Cookies Section 16.4. Cookie Example Chapter 17. The Document Object Model Section 17.1. An Overview of the DOM Section 17.2. Using the Core DOM API Section 17.3. DOM Compatibility with Internet Explorer 4 Section 17.4. DOM Compatibility with Netscape 4 Section 17.5. Convenience Methods: The Traversal and Range APIs Chapter 18. Cascading Style Sheets and Dynamic HTML Section 18.1. Styles and Style Sheets with CSS Section 18.2. Element Positioning with CSS Section 18.3. Scripting Styles Section 18.4. DHTML in Fourth-Generation Browsers Section 18.5. Other DOM APIs for Styles and Style Sheets Chapter 19. Events and Event Handling Section 19.1. Basic Event Handling Section 19.2. Advanced Event Handling with DOM Level 2 Section 19.3. The Internet Explorer Event Model Section 19.4. The Netscape 4 Event Model Chapter 20. Compatibility Techniques Section 20.1. Platform and Browser Compatibility Section 20.2. Language Version Compatibility Section 20.3. Compatibility with Non-JavaScript Browsers Chapter 21. JavaScript Security Section 21.1. JavaScript and Security Section 21.2. Restricted Features Section 21.3. The Same-Origin Policy Section 21.4. Security Zones and Signed Scripts Chapter 22. Using Java with JavaScript Section 22.1. Scripting Java Applets Section 22.2. Using JavaScript from Java Section 22.3. Using Java Classes Directly Section 22.4. LiveConnect Data Types Section 22.5. LiveConnect Data Conversion Section 22.6. JavaScript Conversion of JavaObjects Section 22.7. Java-to-JavaScript Data Conversion Part III: Core JavaScript Reference Chapter 23. Core JavaScript Reference Sample Entry arguments[ ] Arguments Arguments.callee Arguments.length Array Array.concat( ) Array.join( ) Array.length Array.pop( ) Array.push( ) Array.reverse( ) Array.shift( ) Array.slice( ) Array.sort( ) Array.splice( ) Array.toLocaleString( ) Array.toString( ) Array.unshift( ) Boolean Boolean.toString( ) Boolean.valueOf( ) Date Date.getDate( ) Date.getDay( ) Date.getFullYear( ) Date.getHours( ) Date.getMilliseconds( ) Date.getMinutes( ) Date.getMonth( ) Date.getSeconds( ) Date.getTime( ) Date.getTimezoneOffset( ) Date.getUTCDate( ) Date.getUTCDay( ) Date.getUTCFullYear( ) Date.getUTCHours( ) Date.getUTCMilliseconds( ) Date.getUTCMinutes( ) Date.getUTCMonth( ) Date.getUTCSeconds( ) Date.getYear( ) Date.parse( ) Date.setDate( ) Date.setFullYear( ) Date.setHours( ) Date.setMilliseconds( ) Date.setMinutes( ) Date.setMonth( ) Date.setSeconds( ) Date.setTime( ) Date.setUTCDate( ) Date.setUTCFullYear( ) Date.setUTCHours( ) Date.setUTCMilliseconds( ) Date.setUTCMinutes( ) Date.setUTCMonth( ) Date.setUTCSeconds( ) Date.setYear( ) Date.toDateString( ) Date.toGMTString( ) Date.toLocaleDateString( ) Date.toLocaleString( ) Date.toLocaleTimeString( ) Date.toString( ) Date.toTimeString( ) Date.toUTCString( ) Date.UTC( ) Date.valueOf( ) decodeURI( ) decodeURIComponent( ) encodeURI( ) encodeURIComponent( ) Error Error.message Error.name Error.toString( ) escape( ) eval( ) EvalError Function Function.apply( ) Function.arguments[] Function.call( ) Function.caller Function.length Function.prototype Function.toString( ) Global Infinity isFinite( ) isNaN( ) Math Math.abs( ) Math.acos( ) Math.asin( ) Math.atan( ) Math.atan2( ) Math.ceil( ) Math.cos( ) Math.E Math.exp( ) Math.floor( ) Math.LN10 Math.LN2 Math.log( ) Math.LOG10E Math.LOG2E Math.max( ) Math.min( ) Math.PI Math.pow( ) Math.random( ) Math.round( ) Math.sin( ) Math.sqrt( ) Math.SQRT1_2 Math.SQRT2 Math.tan( ) NaN Number Number.MAX_VALUE Number.MIN_VALUE Number.NaN Number.NEGATIVE_INFINITY Number.POSITIVE_INFINITY Number.toExponential( ) Number.toFixed( ) Number.toLocaleString( ) Number.toPrecision( ) Number.toString( ) Number.valueOf( ) Object Object.constructor Object.hasOwnProperty( ) Object.isPrototypeOf( ) Object.propertyIsEnumerable( ) Object.toLocaleString( ) Object.toString( ) Object.valueOf( ) parseFloat( ) parseInt( ) RangeError ReferenceError RegExp RegExp.exec( ) RegExp.global RegExp.ignoreCase RegExp.lastIndex RegExp.source RegExp.test( ) RegExp.toString( ) String String.charAt( ) String.charCodeAt( ) String.concat( ) String.fromCharCode( ) String.indexOf( ) String.lastIndexOf( ) String.length String.localeCompare( ) String.match( ) String.replace( ) String.search( ) String.slice( ) String.split( ) String.substr( ) String.substring( ) String.toLocaleLowerCase( ) String.toLocaleUpperCase( ) String.toLowerCase( ) String.toString( ) String.toUpperCase( ) String.valueOf( ) SyntaxError TypeError undefined unescape( ) URIError Part IV: Client-Side JavaScript Reference Chapter 24. Client-Side JavaScript Reference Sample Entry Anchor Applet Area Button Button.onclick Checkbox Checkbox.onclick Document Document.all[] Document.captureEvents( ) Document.clear( ) Document.close( ) Document.cookie Document.domain Document.elementFromPoint( ) Document.getSelection( ) Document.handleEvent( ) Document.lastModified Document.links[] Document.open( ) Document.releaseEvents( ) Document.routeEvent( ) Document.URL Document.write( ) Document.writeln( ) Element Event FileUpload FileUpload.onchange Form Form.elements[] Form.onreset Form.onsubmit Form.reset( ) Form.submit( ) Form.target Frame getClass( ) Hidden History History.back( ) History.forward( ) History.go( ) HTMLElement HTMLElement.contains( ) HTMLElement.getAttribute( ) HTMLElement.handleEvent( ) HTMLElement.insertAdjacentHTML( ) HTMLElement.insertAdjacentText( ) HTMLElement.onclick HTMLElement.ondblclick HTMLElement.onhelp HTMLElement.onkeydown HTMLElement.onkeypress HTMLElement.onkeyup HTMLElement.onmousedown HTMLElement.onmousemove HTMLElement.onmouseout HTMLElement.onmouseover HTMLElement.onmouseup HTMLElement.removeAttribute( ) HTMLElement.scrollIntoView( ) HTMLElement.setAttribute( ) Image Image.onabort Image.onerror Image.onload Input Input.blur( ) Input.click( ) Input.focus( ) Input.name Input.onblur Input.onchange Input.onclick Input.onfocus Input.select( ) Input.type Input.value JavaArray JavaClass JavaObject JavaPackage JSObject JSObject.call( ) JSObject.eval( ) JSObject.getMember( ) JSObject.getSlot( ) JSObject.getWindow( ) JSObject.removeMember( ) JSObject.setMember( ) JSObject.setSlot( ) JSObject.toString( ) Layer Layer.captureEvents( ) Layer.handleEvent( ) Layer.load( ) Layer.moveAbove( ) Layer.moveBelow( ) Layer.moveBy( ) Layer.moveTo( ) Layer.moveToAbsolute( ) Layer.offset( ) Layer.releaseEvents( ) Layer.resizeBy( ) Layer.resizeTo( ) Layer.routeEvent( ) Link Link.onclick Link.onmouseout Link.onmouseover Link.target Location Location.reload( ) Location.replace( ) MimeType Navigator Navigator.javaEnabled( ) Navigator.plugins.refresh( ) Option Password Plugin Radio Radio.onclick Reset Reset.onclick Screen Select Select.onchange Select.options[] Style Submit Submit.onclick Text Text.onchange Textarea Textarea.onchange URL Window Window.alert( ) Window.back( ) Window.blur( ) Window.captureEvents( ) Window.clearInterval( ) Window.clearTimeout( ) Window.close( ) Window.confirm( ) Window.defaultStatus Window.focus( ) Window.forward( ) Window.handleEvent( ) Window.home( ) Window.moveBy( ) Window.moveTo( ) Window.name Window.navigate( ) Window.onblur Window.onerror Window.onfocus Window.onload Window.onmove Window.onresize Window.onunload Window.open( ) Window.print( ) Window.prompt( ) Window.releaseEvents( ) Window.resizeBy( ) Window.resizeTo( ) Window.routeEvent( ) Window.scroll( ) Window.scrollBy( ) Window.scrollTo( ) Window.setInterval( ) Window.setTimeout( ) Window.status Window.stop( ) Part V: W3C DOM Reference Chapter 25. W3C DOM Reference Sample Entry AbstractView AbstractView.getComputedStyle( ) Attr CDATASection CharacterData CharacterData.appendData( ) CharacterData.deleteData( ) CharacterData.insertData( ) CharacterData.replaceData( ) CharacterData.substringData( ) Comment Counter CSS2Properties CSSCharsetRule CSSFontFaceRule CSSImportRule CSSMediaRule CSSMediaRule.deleteRule( ) CSSMediaRule.insertRule( ) CSSPageRule CSSPrimitiveValue CSSPrimitiveValue.getCounterValue( ) CSSPrimitiveValue.getFloatValue( ) CSSPrimitiveValue.getRectValue( ) CSSPrimitiveValue.getRGBColorValue( ) CSSPrimitiveValue.getStringValue( ) CSSPrimitiveValue.setFloatValue( ) CSSPrimitiveValue.setStringValue( ) CSSRule CSSRuleList CSSRuleList.item( ) CSSStyleDeclaration CSSStyleDeclaration.getPropertyCSSValue( ) CSSStyleDeclaration.getPropertyPriority( ) CSSStyleDeclaration.getPropertyValue( ) CSSStyleDeclaration.item( ) CSSStyleDeclaration.removeProperty( ) CSSStyleDeclaration.setProperty( ) CSSStyleRule CSSStyleSheet CSSStyleSheet.deleteRule( ) CSSStyleSheet.insertRule( ) CSSUnknownRule CSSValue CSSValueList CSSValueList.item( ) Document Document.createAttribute( ) Document.createAttributeNS( ) Document.createCDATASection( ) Document.createComment( ) Document.createDocumentFragment( ) Document.createElement( ) Document.createElementNS( ) Document.createEntityReference( ) Document.createEvent( ) Document.createNodeIterator( ) Document.createProcessingInstruction( ) Document.createRange( ) Document.createTextNode( ) Document.createTreeWalker( ) Document.getElementById( ) Document.getElementsByTagName( ) Document.getElementsByTagNameNS( ) Document.getOverrideStyle( ) Document.importNode( ) DocumentCSS DocumentEvent DocumentFragment DocumentRange DocumentStyle DocumentTraversal DocumentType DocumentView DOMException DOMImplementation DOMImplementation.createCSSStyleSheet( ) DOMImplementation.createDocument( ) DOMImplementation.createDocumentType( ) DOMImplementation.createHTMLDocument( ) DOMImplementation.hasFeature( ) DOMImplementationCSS Element Element.getAttribute( ) Element.getAttributeNode( ) Element.getAttributeNodeNS( ) Element.getAttributeNS( ) Element.getElementsByTagName( ) Element.getElementsByTagNameNS( ) Element.hasAttribute( ) Element.hasAttributeNS( ) Element.removeAttribute( ) Element.removeAttributeNode( ) Element.removeAttributeNS( ) Element.setAttribute( ) Element.setAttributeNode( ) Element.setAttributeNodeNS( ) Element.setAttributeNS( ) ElementCSSInlineStyle Entity EntityReference Event Event.initEvent( ) Event.preventDefault( ) Event.stopPropagation( ) EventException EventListener EventTarget EventTarget.addEventListener( ) EventTarget.dispatchEvent( ) EventTarget.removeEventListener( ) HTMLAnchorElement HTMLAnchorElement.blur( ) HTMLAnchorElement.focus( ) HTMLBodyElement HTMLCollection HTMLCollection.item( ) HTMLCollection.namedItem( ) HTMLDocument HTMLDocument.close( ) HTMLDocument.getElementById( ) HTMLDocument.getElementsByName( ) HTMLDocument.open( ) HTMLDocument.write( ) HTMLDocument.writeln( ) HTMLDOMImplementation HTMLElement HTMLFormElement HTMLFormElement.reset( ) HTMLFormElement.submit( ) HTMLInputElement HTMLInputElement.blur( ) HTMLInputElement.click( ) HTMLInputElement.focus( ) HTMLInputElement.select( ) HTMLOptionElement HTMLSelectElement HTMLSelectElement.add( ) HTMLSelectElement.blur( ) HTMLSelectElement.focus( ) HTMLSelectElement.remove( ) HTMLTableCaptionElement HTMLTableCellElement HTMLTableColElement HTMLTableElement HTMLTableElement.createCaption( ) HTMLTableElement.createTFoot( ) HTMLTableElement.createTHead( ) HTMLTableElement.deleteCaption( ) HTMLTableElement.deleteRow( ) HTMLTableElement.deleteTFoot( ) HTMLTableElement.deleteTHead( ) HTMLTableElement.insertRow( ) HTMLTableRowElement HTMLTableRowElement.deleteCell( ) HTMLTableRowElement.insertCell( ) HTMLTableSectionElement HTMLTableSectionElement.deleteRow( ) HTMLTableSectionElement.insertRow( ) HTMLTextAreaElement HTMLTextAreaElement.blur( ) HTMLTextAreaElement.focus( ) HTMLTextAreaElement.select( ) LinkStyle MediaList MediaList.appendMedium( ) MediaList.deleteMedium( ) MediaList.item( ) MouseEvent MouseEvent.initMouseEvent( ) MutationEvent MutationEvent.initMutationEvent( ) NamedNodeMap NamedNodeMap.getNamedItem( ) NamedNodeMap.getNamedItemNS( ) NamedNodeMap.item( ) NamedNodeMap.removeNamedItem( ) NamedNodeMap.removeNamedItemNS( ) NamedNodeMap.setNamedItem( ) NamedNodeMap.setNamedItemNS( ) Node Node.appendChild( ) Node.cloneNode( ) Node.hasAttributes( ) Node.hasChildNodes( ) Node.insertBefore( ) Node.isSupported( ) Node.normalize( ) Node.removeChild( ) Node.replaceChild( ) NodeFilter NodeIterator NodeIterator.detach( ) NodeIterator.nextNode( ) NodeIterator.previousNode( ) NodeList NodeList.item( ) Notation ProcessingInstruction Range Range.cloneContents( ) Range.cloneRange( ) Range.collapse( ) Range.compareBoundaryPoints( ) Range.deleteContents( ) Range.detach( ) Range.extractContents( ) Range.insertNode( ) Range.selectNode( ) Range.selectNodeContents( ) Range.setEnd( ) Range.setEndAfter( ) Range.setEndBefore( ) Range.setStart( ) Range.setStartAfter( ) Range.setStartBefore( ) Range.surroundContents( ) Range.toString( ) RangeException Rect RGBColor StyleSheet StyleSheetList StyleSheetList.item( ) Text Text.splitText( ) TreeWalker TreeWalker.firstChild( ) TreeWalker.lastChild( ) TreeWalker.nextNode( ) TreeWalker.nextSibling( ) TreeWalker.parentNode( ) TreeWalker.previousNode( ) TreeWalker.previousSibling( ) UIEvent UIEvent.initUIEvent( ) ViewCSS Part VI: Class, Property, Method, and Event Handler Index Chapter 26. Class, Property, Method, and Event Handler Index Section 26.1. A Section 26.2. B Section 26.3. C Section 26.4. D Section 26.5. E Section 26.6. F Section 26.7. G Section 26.8. H Section 26.9. I Section 26.10. J Section 26.11. K Section 26.12. L Section 26.13. M Section 26.14. N Section 26.15. O Section 26.16. P Section 26.17. Q Section 26.18. R Section 26.19. S Section 26.20. T Section 26.21. U Section 26.22. V Section 26.23. W Section 26.24. X Section 26.25. Y Section 26.26. Z
JS的常用对象[转载]web 技术 2010-06-05 15:00:30 阅读3 评论0 字号:大小 订阅 [removed] Window For JavaScript 熟练window对象的open、close、alert、confirm、prompt、setTimeout、clearTimeout、setInterval、clearInterval、moveBy、resizeBy、scrollBy方法的使用 掌握window对象的moveTo、resizeTo、scrollTo、print方法的使用 熟练掌握window对象的status、location、name、self、opener属性的使用  Window对象是客户端javascript最高层对象之一,只要打开浏览器窗口,不管该窗口是否有打开的网页,当遇到BODY、FRAMESET或FRAME元素时,都会自动建立window对象的实例。另外,该对象的实例也可由window.open()方法创建。由于window对象是其它大部分对象的共同祖先,在调用window对象的方法和属性时,可以省略window对象的引用。例如:window.[removed]()可以简写成: [removed]()。  在窗口觖发本窗口对象的任何方法和属性时可以省去窗口的实例名称。例如给当前的myWin窗口设置status属性时,可以只用status而不用myWin.status。但是,在事件处理调用location属性、close()方法或open()方法时必须使用实例名称。 6-2-1 window对象的方法 window对象有以下方法: open close alert confirm prompt setTimeout clearTimeout setInterval clearInterval moveBy moveTo resizeBy resizeTo scrollBy scrollTo find back forward home stop print blur focus captureEvent enableExternalCapture disableExternalCapture handleEvent releaseEvent routeEvent scroll   1. open方法   语法格式: window.open(URL,窗口名称,窗口风格)   功能:打开一个新的窗口,并在窗口装载指定URL地址的网页。   说明: open方法用于打开一个新的浏览器窗口,并在新窗口装入一个指定的URL地址 ; open方法在打开一个新的浏览器窗口时,还可以指定窗口的名称(第二个参数); open方法在打开一个新的浏览器窗口时,还可以指定窗口的风格(第三个参数), 窗口风格有以下选项,这些选项可以多选,如果多选,各选项之间用逗号分隔: toolbar:指定窗口是否有标准工具栏。当该选项的值为1或yes时,表示有标准 工具栏,当该选项的值为0或no时,表示没有标准工具栏; location:指定窗口是否有地址工具栏,选项的值及含义与toolbar相同; directories:指定窗口是否有链接工具栏,选项的值及含义与toolbar相同; status:指定窗口是否有状态栏,选项的值及含义与toolbar相同; menubar:指定窗口是否有菜单,选项的值及含义与toolbar相同; scrollbar:指定当前窗口文档大于窗口时是否有滚动条,选项的值及含义与 toolbar相同; resizable:指定窗口是否可改变大小,选项的值及含义与toolbar相同; width:以像素为单位指定窗口的宽度,已被innerWidth取代; height:以像素为单位指定窗口的高度,已被innerHeight取代; outerWidth:以像素为单位指定窗口的外部宽度; outerHeight:以像素为单位指定窗口的外部高度; left:以像素为单位指定窗口距屏幕左边的位置; top:以像素为单位指定窗口距屏幕顶端的位置; alwaysLowered:指定窗口隐藏在所有窗口之后,选项的值及含义与toolbar相同 ; alwaysRaised:指定窗口浮在所有窗口之上,选项的值及含义与toolbar相同; dependent:指定打开的窗口为当前窗口的一个子窗口,并随着父窗口的关闭而 关闭,选项的值及含义与toolbar相同; hotke

87,907

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧