Home  >  Article  >  Web Front-end  >  Detailed arrangement of javascript Window and document objects_Basic knowledge

Detailed arrangement of javascript Window and document objects_Basic knowledge

WBOY
WBOYOriginal
2016-05-16 18:12:06957browse
1. Window object
 --------------------------------------------- ------------- ------------------  
 Object properties
 window //Window itself
 window. self //Reference this window window=window.self
window.name //Name the window
window.defaultStatus //Set the window status bar information
window.location //URL address, configure this Properties can open a new page
 ---------------------------------------- ---------- -------------------
 Object method
 window.alert("text") //Prompt message dialog box
window.confirm("text") //Confirm dialog box
window.prompt("text") //Require keyboard input dialog box
window.setIntervel("action",time) //Every Execute an operation every specified time (milliseconds)
window.clearInterval() //The function of clearing the time configuration is to terminate the cycle
Window.setTimeout(action, time) //After the specified time (milliseconds) )Perform an operation
 window.open() //Open a new window
 window.close() //Close the window
 ----------------- ---------------------------------- ------------------ --
Member object
window.event
window.document //See document object for details
window.history
window.screen
window.navigator
window.external
------------------------------------------------ -------------------
 window.history object
 window.history.length //Number of pages viewed
 history.back( ) //Retreat
history.forward() //Progress
history.go(i) //Forward or go back to the i-th page of the history
//i>0 progress, i  ------------------------------------------------ ------- -------------------
window.screen object
window.screen.width //Screen width
window. screen.height //Screen height
window.screen.colorDepth //Screen color depth
window.screen.availWidth //Available width
window.screen.availHeight //Available height (excluding the height of the taskbar )
 ------------------------------------------------ ---- -------------------
window.external object
window.external.AddFavorite("Address", "Title" ) // Add website to favorites
 ---------------------------------------- ---------- -------------------
 window.navigator object
 window.navigator.appCodeName //Browser code name
window.navigator.appName //Browser program name
window.navigator.appMinorVersion //Browser patch version
window.navigator.cpuClass //cpu type x86
window.navigator.platform / /Operating system type win32
window.navigator.plugins
window.navigator.opsProfile
window.navigator.userProfile
window.navigator.systemLanguage //Customer system language zh-cn simplified Chinese
window.navigator.userLanguage //User language, same as above
window.navigator.appVersion //Browser version (including system version)
window.navigator.userAgent
window.navigator.onLine //Is the user online?
window.navigator.cookieEnabled //Whether the browser supports cookies
window.navigator.mimeTypes
======================== ==========================

2. Document object

객체 속성:
document.title //HTML 태그와 동일한 문서 제목 설정 <br>document.bgColor //페이지 배경색 설정 <br>document.fgColor //전경 설정 color ( 텍스트 색상) <br>document.linkColor //클릭하지 않은 링크 색상<br>document.alinkColor //활성 링크 색상(포커스는 이 링크에 있음)<br>document.vlinkColor //색상 클릭한 링크 <br>document.URL //같은 창에서 다른 웹페이지를 열도록 URL 속성 설정<br>document.fileCreatedDate //파일 생성 날짜, 읽기 전용 속성<br>document.fileModifiedDate //파일 수정됨 날짜, 읽기 전용 속성<br>document.fileSize //파일 크기, 읽기 전용 속성<br>document.cookie //쿠키 설정 및 읽기 <br>document.charset //문자 집합 설정 중국어 간체: gb2312 <br>------ ---------- <br><br>일반적인 객체 메서드<br><br>document.write() //동적으로 페이지에 콘텐츠 쓰기 <br>document.createElement(Tag) //html 태그 객체 생성<br>document.getElementById(ID) //지정된 ID 값을 가진 객체 가져오기<br>document.getElementsByName( Name) //지정된 Name 값을 가진 객체를 가져옵니다. <br>document.body.appendChild(oTag) <br><br>body-body sub-object<br><br>document.body //시작 및 문서 본문의 끝은
document.body.bgColor //객체 뒤의 배경색을 설정하거나 가져옵니다
document.body.link //클릭하지 않은 링크의 색상
document.body.alink //링크 활성화(초점이 이 링크에 있음) 위)
document.body.vlink //클릭한 링크의 색상
document.body.text //텍스트 색상
document.body .innerText //설정...
document.body.innerHTML 사이의 텍스트 //...
document.body.topMargin 사이의 HTML 코드 설정 / /페이지 상단 여백
document.body .leftMargin //페이지 왼쪽 여백
document.body.rightMargin //페이지 오른쪽 여백
document.body.bottomMargin //페이지 하단 여백 페이지
document.body.ground //배경 이미지
document.body.appendChild(oTag) //동적으로 HTML 객체 생성
공통 객체 이벤트

document.body.onclick= "func()" //마우스 포인터로 객체를 클릭하면 트리거됩니다
document.body.onmouseover="func()" //마우스 포인터가 객체로 이동할 때 트리거됩니다
document.body.onmouseout= "func()" //마우스 포인터가 객체 밖으로 이동할 때 트리거
location-location 하위 객체
document.location.hash // #
document.location.host 다음 부분 // 도메인 이름 포트 번호
document.location.hostname // 도메인 이름
document.location.href // 전체 URL
document.location.pathname // 디렉토리 부분
document.location.port // 포트 번호
document.location.protocol // 네트워크 프로토콜(http:)
document.location.search // ? 숫자 뒤의 부분

공통 개체 이벤트
documeny.location. reload() //웹페이지 새로고침
document.location.reload(URL) //새 웹페이지 열기
document.location .sign(URL) //새 웹페이지 열기
document. location.replace(URL) //새 웹페이지 열기
=================================== ======================================
선택-선택 하위 개체
문서.선택
=========================================== =============================
이미지 컬렉션(페이지 이미지 내):
------ ----------------------
a) 컬렉션을 통해
document.images 참조 //페이지의 해당 Detailed arrangement of javascript Window and document objects_Basic knowledge 태그
document.images.length //해당 페이지의 Detailed arrangement of javascript Window and document objects_Basic knowledge 태그 개수
document.images[0] //첫 번째 Detailed arrangement of javascript Window and document objects_Basic knowledge 태그
document.images[i] //i-1th Detailed arrangement of javascript Window and document objects_Basic knowledge 태그
-------------------------------
b)
직접 참조Detailed arrangement of javascript Window and document objects_Basic knowledge
document.images.oImage //document.images.name 속성
--- nane 속성을 통해 ----------- -
c) 이미지의 src 속성 참조
document.images.oImage.src //document.images.name attribute.src
------ --------- --------------
d) 이미지 생성
var oImage
oImage = new Image()
document .images.oImage.src="1. jpg"
동시에 해당 페이지에 Detailed arrangement of javascript Window and document objects_Basic knowledge 태그를 생성하여
--- ------- 표시합니다. -----
샘플 코드(동적 이미지 생성):

Detailed arrangement of javascript Window and document objects_Basic knowledge




Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn