search
HomeWeb Front-endJS TutorialDetailed arrangement of javascript Window and document objects_Basic knowledge

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.
동시에 해당 페이지에 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
From C/C   to JavaScript: How It All WorksFrom C/C to JavaScript: How It All WorksApr 14, 2025 am 12:05 AM

The shift from C/C to JavaScript requires adapting to dynamic typing, garbage collection and asynchronous programming. 1) C/C is a statically typed language that requires manual memory management, while JavaScript is dynamically typed and garbage collection is automatically processed. 2) C/C needs to be compiled into machine code, while JavaScript is an interpreted language. 3) JavaScript introduces concepts such as closures, prototype chains and Promise, which enhances flexibility and asynchronous programming capabilities.

JavaScript Engines: Comparing ImplementationsJavaScript Engines: Comparing ImplementationsApr 13, 2025 am 12:05 AM

Different JavaScript engines have different effects when parsing and executing JavaScript code, because the implementation principles and optimization strategies of each engine differ. 1. Lexical analysis: convert source code into lexical unit. 2. Grammar analysis: Generate an abstract syntax tree. 3. Optimization and compilation: Generate machine code through the JIT compiler. 4. Execute: Run the machine code. V8 engine optimizes through instant compilation and hidden class, SpiderMonkey uses a type inference system, resulting in different performance performance on the same code.

Beyond the Browser: JavaScript in the Real WorldBeyond the Browser: JavaScript in the Real WorldApr 12, 2025 am 12:06 AM

JavaScript's applications in the real world include server-side programming, mobile application development and Internet of Things control: 1. Server-side programming is realized through Node.js, suitable for high concurrent request processing. 2. Mobile application development is carried out through ReactNative and supports cross-platform deployment. 3. Used for IoT device control through Johnny-Five library, suitable for hardware interaction.

Building a Multi-Tenant SaaS Application with Next.js (Backend Integration)Building a Multi-Tenant SaaS Application with Next.js (Backend Integration)Apr 11, 2025 am 08:23 AM

I built a functional multi-tenant SaaS application (an EdTech app) with your everyday tech tool and you can do the same. First, what’s a multi-tenant SaaS application? Multi-tenant SaaS applications let you serve multiple customers from a sing

How to Build a Multi-Tenant SaaS Application with Next.js (Frontend Integration)How to Build a Multi-Tenant SaaS Application with Next.js (Frontend Integration)Apr 11, 2025 am 08:22 AM

This article demonstrates frontend integration with a backend secured by Permit, building a functional EdTech SaaS application using Next.js. The frontend fetches user permissions to control UI visibility and ensures API requests adhere to role-base

JavaScript: Exploring the Versatility of a Web LanguageJavaScript: Exploring the Versatility of a Web LanguageApr 11, 2025 am 12:01 AM

JavaScript is the core language of modern web development and is widely used for its diversity and flexibility. 1) Front-end development: build dynamic web pages and single-page applications through DOM operations and modern frameworks (such as React, Vue.js, Angular). 2) Server-side development: Node.js uses a non-blocking I/O model to handle high concurrency and real-time applications. 3) Mobile and desktop application development: cross-platform development is realized through ReactNative and Electron to improve development efficiency.

The Evolution of JavaScript: Current Trends and Future ProspectsThe Evolution of JavaScript: Current Trends and Future ProspectsApr 10, 2025 am 09:33 AM

The latest trends in JavaScript include the rise of TypeScript, the popularity of modern frameworks and libraries, and the application of WebAssembly. Future prospects cover more powerful type systems, the development of server-side JavaScript, the expansion of artificial intelligence and machine learning, and the potential of IoT and edge computing.

Demystifying JavaScript: What It Does and Why It MattersDemystifying JavaScript: What It Does and Why It MattersApr 09, 2025 am 12:07 AM

JavaScript is the cornerstone of modern web development, and its main functions include event-driven programming, dynamic content generation and asynchronous programming. 1) Event-driven programming allows web pages to change dynamically according to user operations. 2) Dynamic content generation allows page content to be adjusted according to conditions. 3) Asynchronous programming ensures that the user interface is not blocked. JavaScript is widely used in web interaction, single-page application and server-side development, greatly improving the flexibility of user experience and cross-platform development.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment