search
HomeWeb Front-endJS TutorialOther Objects in JavaScript_Basics

anchors[]; links[]; Link connection object
usage: document.anchors[[x]]; document.links[[x]]; ;
Document.anchors is an array , including all anchor tags in the document ( tags containing the name attribute), and a subscript is defined for each anchor tag starting from 0 according to the order in the document.
Document.links is also an array, containing all link tags in the document (including the
tag of the href attribute and the tag in the tag segment), in order in the document, starting from 0 An index is defined for each connection tag.
If a
tag has both name and href attributes, it is both an Anchor object and a Link object.
In IE, if you add the "id="..."" attribute to the
tag, the object will be assigned an identity (ID). When calling this object, you only need to use "” That’s it. Many document components can use this method to assign IDs, but be careful that no two IDs are the same.
anchors and links are arrays and have array properties and methods. A single Anchor object has no properties; the properties of a single Link object are shown below.

Attributes
protocol; hostname; port; host; pathname; hash; search; href are the same as location objects.
target returns/specifies the target window (string) of the connection, which is the same as the target attribute in the
tag.
Event
onclick; onmouseover; onmouseout; onmousedown; onmouseup

applets[] Java applet object It is an array that contains all Applet objects (Java applet) in the document. As an array, there are array properties and methods. Regarding the properties and methods of a single Applet object, I quote: "The Applet object inherits all public properties and methods of the Java applet." (English original sentence: The Applet object inherits all public properties of the Java applet./The Applet object inherits all public methods of the Java applet.) Because I hate Java applets, I am not interested in its "public" and "private" issues, so I did not discuss them.
embeds[] Plug-in object It is an array that contains all plug-ins ( tags) in the document. Because each plug-in is different, each Embed object also has different properties and methods.
forms[]; Form form object document.forms[] is an array that contains all the forms in the document (

). To reference a single form, you can use document.forms[x], but generally speaking, people will do this: add the "name="..."" attribute to the
tag, then directly use "document." can be quoted.

Attributes of the Form object
name returns the name of the form, which is the
attribute.
action returns/sets the submission address of the form, which is the
attribute.
method returns/sets the form submission method, which is the
attribute.
target returns/sets the window returned after the form is submitted, which is the
attribute.
encoding returns/sets the encoding method of form submission content, which is the
attribute.
length returns the number of elements contained in the form.
Method
reset() resets the form. This is the same as pressing the "reset" button.
submit() submits the form. This is the same as pressing the "Submit" button.
Event
onreset; onsubmit

The following from "Button" to "Textarea" are all element objects of the form.
Button button object is specified by "". To reference a Button object, you can use "..". refers to the value of the "name="..."" attribute in the tag. You can use this method to reference any form element.

Attribute
name Returns/sets the name of the element specified with .
value returns/sets the value of the element specified with .
form returns the form object containing this element.
Method
blur() removes focus from an object.
focus() gives the object focus.
click() simulates a mouse click on the object.
Event
onclick; onmousedown; onmouseup

Checkbox checkbox object specified by "".

Attribute
name Returns/sets the name of the element specified with .
value returns/sets the value of the element specified with .
form returns the form object containing this element.
checked returns/sets whether the checkbox object is checked. This is a boolean value.
defaultChecked returns/sets whether the checkbox object is checked by default. This is a boolean value.
Method
blur() removes focus from an object.
focus() gives the object focus.
click() simulates a mouse click on the object.
Event
onclick

elements[]; Element form element object .elements is an array that contains all the objects of the form. Generally we do not use this array, but directly reference each specific object.
Hidden Hidden objects are specified by "".

Attribute
name Returns/sets the name of the element specified with .
value returns/sets the value of the element specified with .
form returns the form object containing this element.

Password Password input area object is specified by "".

Attribute
name Returns/sets the name of the element specified with .
value returns/sets the current value of the password input area.
defaultValue returns the default value specified with .
form returns the form object containing this element.
Method
blur() removes focus from an object.
focus() gives the object focus.
select() selects all the text in the password input area.
Event
onchange

Radio radio field object specified by "". A group of Radio objects have a common name (name attribute), so document.formName.radioName becomes an array. To access a single Radio object use: document.formName.radioName[x].

Attributes of a single Radio object
name returns/sets the name of the element specified with .
value returns/sets the value of the element specified with .
form returns the form object containing this element.
checked returns/sets whether the radio field object is selected. This is a boolean value.
defaultChecked returns/sets whether the object is selected by default. This is a boolean value.
Method
blur() removes focus from an object.
focus() gives the object focus.
click() simulates a mouse click on the object.
Event
onclick

Reset reset button object specified by "". Because Reset is also a button, it also has properties and methods of Button objects. As for the "onclick" event, it is generally replaced by onreset of the Form object.
Select selection area (drop-down menu, list) object is specified by ".
length returns the number of options under the Select object.
selectedIndex returns the index of the selected option. This subscript is the position of the option in the options[] array. If the Select object allows multiple selections, returns the index of the first selected option.
form returns the form object containing this element.
Method
blur() removes focus from an object.
focus() gives the object focus.
Event
onchange

options[]; Option selection object options[] is an array that contains Option objects under the same Select object. Option objects are specified by ". Because Submit is also a button, it also has the properties and methods of Button object. As for the "onclick" event, it is generally replaced by onsubmit of the Form object.
Text text The box object is specified by "". The Password object is also a type of Text object, so all the properties, methods and events of the Password object are available in the Text area object. "Specify. All the properties, methods and events of the Textarea object are the same as the Text object, that is, the same as the Password object.
images[]; Image image object document.images[] is an array that contains all the images in the document (

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
JavaScript Frameworks: Powering Modern Web DevelopmentJavaScript Frameworks: Powering Modern Web DevelopmentMay 02, 2025 am 12:04 AM

The power of the JavaScript framework lies in simplifying development, improving user experience and application performance. When choosing a framework, consider: 1. Project size and complexity, 2. Team experience, 3. Ecosystem and community support.

The Relationship Between JavaScript, C  , and BrowsersThe Relationship Between JavaScript, C , and BrowsersMay 01, 2025 am 12:06 AM

Introduction I know you may find it strange, what exactly does JavaScript, C and browser have to do? They seem to be unrelated, but in fact, they play a very important role in modern web development. Today we will discuss the close connection between these three. Through this article, you will learn how JavaScript runs in the browser, the role of C in the browser engine, and how they work together to drive rendering and interaction of web pages. We all know the relationship between JavaScript and browser. JavaScript is the core language of front-end development. It runs directly in the browser, making web pages vivid and interesting. Have you ever wondered why JavaScr

Node.js Streams with TypeScriptNode.js Streams with TypeScriptApr 30, 2025 am 08:22 AM

Node.js excels at efficient I/O, largely thanks to streams. Streams process data incrementally, avoiding memory overload—ideal for large files, network tasks, and real-time applications. Combining streams with TypeScript's type safety creates a powe

Python vs. JavaScript: Performance and Efficiency ConsiderationsPython vs. JavaScript: Performance and Efficiency ConsiderationsApr 30, 2025 am 12:08 AM

The differences in performance and efficiency between Python and JavaScript are mainly reflected in: 1) As an interpreted language, Python runs slowly but has high development efficiency and is suitable for rapid prototype development; 2) JavaScript is limited to single thread in the browser, but multi-threading and asynchronous I/O can be used to improve performance in Node.js, and both have advantages in actual projects.

The Origins of JavaScript: Exploring Its Implementation LanguageThe Origins of JavaScript: Exploring Its Implementation LanguageApr 29, 2025 am 12:51 AM

JavaScript originated in 1995 and was created by Brandon Ike, and realized the language into C. 1.C language provides high performance and system-level programming capabilities for JavaScript. 2. JavaScript's memory management and performance optimization rely on C language. 3. The cross-platform feature of C language helps JavaScript run efficiently on different operating systems.

Behind the Scenes: What Language Powers JavaScript?Behind the Scenes: What Language Powers JavaScript?Apr 28, 2025 am 12:01 AM

JavaScript runs in browsers and Node.js environments and relies on the JavaScript engine to parse and execute code. 1) Generate abstract syntax tree (AST) in the parsing stage; 2) convert AST into bytecode or machine code in the compilation stage; 3) execute the compiled code in the execution stage.

The Future of Python and JavaScript: Trends and PredictionsThe Future of Python and JavaScript: Trends and PredictionsApr 27, 2025 am 12:21 AM

The future trends of Python and JavaScript include: 1. Python will consolidate its position in the fields of scientific computing and AI, 2. JavaScript will promote the development of web technology, 3. Cross-platform development will become a hot topic, and 4. Performance optimization will be the focus. Both will continue to expand application scenarios in their respective fields and make more breakthroughs in performance.

Python vs. JavaScript: Development Environments and ToolsPython vs. JavaScript: Development Environments and ToolsApr 26, 2025 am 12:09 AM

Both Python and JavaScript's choices in development environments are important. 1) Python's development environment includes PyCharm, JupyterNotebook and Anaconda, which are suitable for data science and rapid prototyping. 2) The development environment of JavaScript includes Node.js, VSCode and Webpack, which are suitable for front-end and back-end development. Choosing the right tools according to project needs can improve development efficiency and project success rate.

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

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

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.

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor