Javascript Articles - Page 597 of 671

What are the different types of DOM available to access and modify content in JavaScript?

Shubham Vora
Updated on 15-Nov-2022 10:54:22

1K+ Views

In this tutorial, we will learn what are the different types of DOM available to access and modify content in JavaScript. The Document Object Model (DOM) is a data representation of the objects that form the structure and content of a web document. It is an interface for scripting web pages. Programs can alter the document’s structure, style, and content by utilizing the DOM. The DOM represents each element as a node, and the programming languages like JavaScript can easily interact with the nodes to modify the page. There are different types of DOM available to access and modify content ... Read More

How to access document properties using W3C DOM method?

Sravani S
Updated on 23-Jun-2020 07:06:52

175 Views

This IE4 document object model (DOM) introduced in Version 4 of Microsoft's Internet Explorer browser. IE 5 and later versions include support for most basic W3C DOM features.ExampleTo access document properties using W3C DOM method, you can try to run the following code −           Document Title                                     This is main title       Click the following to see the result:                                                          

What is the role of special characters in JavaScript Regular Expressions?

V Jyothi
Updated on 23-Jun-2020 07:21:43

288 Views

The frequency or position of bracketed character sequences and single characters can be denoted by a special character. Each special character has a specific connotation. The +, *, ?, and $ flags all follow a character sequence.Sr.NoExpression & Description1p+It matches any string containing one or more p's.2p*It matches any string containing zero or more p's.3p?It matches any string containing at most one p.4p{N}It matches any string containing a sequence of N p's5p{2, 3}It matches any string containing a sequence of two or three p's.6p{2, }It matches any string containing a sequence of at least two p's.7p$It matches any string with p ... Read More

What are the document properties which can be accessed using Legacy DOM?

Nishtha Thakur
Updated on 23-Jun-2020 07:22:35

141 Views

The following are the document properties which can be accessed using Legacy DOM −Sr.NoProperty & Description1alinkColorDeprecated − A string that specifies the color of activated links.Ex − document.alinkColor2anchors[ ]An array of Anchor objects, one for each anchor that appears in the documentEx − document.anchors[0], document.anchors[1] and so on3applets[ ]An array of Applet objects, one for each applet that appears in the documentEx − document.applets[0], document.applets[1] and so on4bgColorDeprecated − A string that specifies the background color of the document.Ex − document.bgColor5cookieA string-valued property with special behavior that allows the cookies associated with this document to be queried and set.Ex − ... Read More

What are the document methods supported by Legacy DOM?

Priya Pallavi
Updated on 23-Jun-2020 07:23:30

134 Views

The following is the list of document methods supported by Legacy DOM −Sr.NoProperty & Description1clear( )Deprecated − Erases the contents of the document and returns nothing.Ex − document.clear( )2close( )Closes a document stream opened with the open( ) method and returns nothing.Ex − document.close( )3open( )Deletes existing document content and opens a stream to which new document contents may be written. Returns nothing.Ex − document.open( )4write( value, ...)Inserts the specified string or strings into the document currently being parsed or appends to document opened with open( ). Returns nothing.Ex − document.write( value, ...)5writeln( value, ...)Identical to write( ), except that ... Read More

How objects are organized in a web document? How is it arranged in a hierarchy?

Anvi Jain
Updated on 23-Jun-2020 07:24:03

250 Views

The Objects are organized in a hierarchy. This hierarchical structure applies to the organization of objects in a Web document.Window object − Top of the hierarchy. It is the utmost element of the object hierarchy.Document object − Each HTML document that gets loaded into a window becomes a document object. The document contains the contents of the page.Form object − Everything enclosed in the ... tags sets the form object.Form control elements − The form object contains all the elements defined for that object such as text fields, buttons, radio buttons, and checkboxes.The following is a simple hierarchy of a ... Read More

How can I access document properties using Legacy DOM method in JavaScript?

Srinivas Gorla
Updated on 23-Jun-2020 07:24:34

191 Views

To access document properties using Legacy DOM method in JavaScript, you can try to run the following code −Example           Document Title                                     This is main title       Click the following to see the result:                                                        

How can I write a script to use either W3C DOM or IE 4 DOM depending on their availability?

Abhinanda Shri
Updated on 23-Jun-2020 07:25:37

146 Views

If you want to write a script with the flexibility to use either W3C DOM or IE 4 DOM depending on their availability, then you can use a capability-testing approach that first checks for the existence of a method or property to determine whether the browser has the capability you desire.The following is the code snippet showing the same −if (document.getElementById) {    // If the W3C method exists, use it } else if (document.all) {    // If the all[] array exists, use it } else {    // Otherwise use the legacy DOM }

What is the role of throw statement in JavaScript?

Jennifer Nicholas
Updated on 23-Jun-2020 07:25:09

185 Views

Use the throw statement to raise your built-in exceptions or your customized exceptions. Later these exceptions can be captured and you can take appropriate action.ExampleYou can try to run the following code to implement throw statement −                                         Click the following to see the result:                          

What are the three types of errors I can expect in my JavaScript script?

Shubham Vora
Updated on 31-Oct-2022 11:21:36

494 Views

In this tutorial, let us discuss the three types of errors we can expect in our JavaScript code. Errors are statements that block the execution of the program. During the compilation of the program, three types of errors can occur. These are syntax errors, run time errors, and logical errors. Syntax Errors Syntax errors are usual errors. Incorrect syntax causes parsing issues during the code interpretation. For example, add a semicolon instead of a colon in an object declaration. Syntax errors affect only the respective code thread. The remaining code works as it is. A grammatical mistake is the ultimate ... Read More

Advertisements