Javascript Articles - Page 547 of 607

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

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

317 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

168 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

158 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

270 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

223 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

166 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

216 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

560 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

What is the difference between setTimeout() and setInterval() in JavaScript?

Rishi Rathor
Updated on 24-Nov-2023 00:58:53

2K+ Views

setTimeout() function setTimeout( function, duration) − This function calls function after duration milliseconds from now. This goes for one execution. Let’s see an example − It waits for 2000 milliseconds, and then runs the callback function alert(‘Hello’) − setTimeout(function() { alert('Hello');}, 2000); setInterval() function setInterval(function, duration) − This function calls function after every duration milliseconds. This goes for unlimited times. Let’s see an example − It triggers the alert(‘Hello’) after every 2000 milliseconds, not only once. setInterval(function() { alert('Hello');}, 2000);

With JavaScript how can I find the name of the web browser, with version?

Abhinaya
Updated on 23-Jun-2020 07:01:42

370 Views

To find the name of the web browser, with version, you need to try the following code −Example           Browser Detection Example                                  

Advertisements