javascript入门笔记(5)——window

来源:互联网 发布:便笺元数据损坏的原因 编辑:程序博客网 时间:2024/06/03 17:52

window

    • window
      • global object
      • document
        • document model
      • javascript in html
      • event
        • body
          • - onLoad
          • - onUnload
      • simple dialog
      • status
      • timer
      • openclose
      • moveTo
      • location

global object

  • window is browser’s global object.

  • all global augments is window’s member

e.g:

var a = 12;alert(window.a);//12

document

  • windows.document is html page.
  • document.write() writes content into page.
  • elements like >html> are all members of document.

document model

enter image description here

javascript in html

  • < script> < /script>
  • < script src=”tut.js”>< /script>
  • in the event handler of an element

event

< p onMouseOver = "alert('hi');" onMouseOut="alert('bye');">

body

- onLoad
- onUnload

simple dialog

  • alert() // ok
  • confirm() //yes or no
  • prompt() //type in

status

< p onMouseOver = "status='go';" onMouseOut="status='';">

timer

setInterval();

<body onload = "setInterval('update()',1000);";

open\close

w = window.open(“a.html”,”a”,”width = 400,height=500”);
w.close;
window.close();

moveTo()

w.moveTo(0 ,0)

location

indicates the URL

0 0
原创粉丝点击