Javascript Articles

Page 446 of 534

How to perform Multiline matching with JavaScript RegExp?

Moumita
Moumita
Updated on 23-Jun-2020 681 Views

To perform multiline matching, use the M modifier available in JavaScript Regular Expression.ExampleYou can try to run the following code to perform multiline matching −           JavaScript Regular Expression                        var myStr = "Welcoming!";          var reg = /^ing/m;          var match = myStr.match(reg);                    document.write(match);          

Read More

Which is the JavaScript RegExp to find any alternative text?

Nikitha N
Nikitha N
Updated on 23-Jun-2020 264 Views

To match any of the specified alternatives, follow the below-given pattern −(foo|bar|baz)ExampleYou can try to run the following code to find any alternative text −           JavaScript Regular Expression                        var myStr = "one,one,one, two, three, four, four";          var reg = /(one|two|three)/g;          var match = myStr.match(reg);          document.write(match);          

Read More

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

Abhinanda Shri
Abhinanda Shri
Updated on 23-Jun-2020 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 }

Read More

What is the role of throw statement in JavaScript?

Jennifer Nicholas
Jennifer Nicholas
Updated on 23-Jun-2020 218 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:                          

Read More

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

Srinivas Gorla
Srinivas Gorla
Updated on 23-Jun-2020 227 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:                                                        

Read More

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

Anvi Jain
Anvi Jain
Updated on 23-Jun-2020 272 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

What are the document methods supported by Legacy DOM?

Priya Pallavi
Priya Pallavi
Updated on 23-Jun-2020 162 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

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

V Jyothi
V Jyothi
Updated on 23-Jun-2020 318 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

How to access document properties using W3C DOM method?

Sravani S
Sravani S
Updated on 23-Jun-2020 211 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:                                                          

Read More

How to get the list of document properties which can be accessed using W3C DOM?

Ramu Prasad
Ramu Prasad
Updated on 23-Jun-2020 254 Views

The following are the document properties which can be accessed using W3C DOM −Sr.NoProperty & Description1BodyA reference to the Element object that represents the tag of this document.Ex − document.body2DefaultViewIts Read-only property and represents the window in which the document is displayed.Ex − document.defaultView3DocumentElementA read-only reference to the tag of the document.Ex − document.documentElement8/31/20084ImplementationIt is a read-only property and represents the DOMImplementation object that represents the implementation that created this document.Ex − document.implementation

Read More
Showing 4451–4460 of 5,338 articles
« Prev 1 444 445 446 447 448 534 Next »
Advertisements