Programming Scripts Articles

Page 13 of 33

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 271 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 161 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

How to reduce the number of errors in scripts?

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

To reduce the number of errors in scripts, follow the below-given tips −Use plenty of comments. Comments enable you to explain why you wrote the script the way you did and to explain particularly difficult sections of code.Always use indentation to make your code easy to read. Indenting statements also make it easier for you to match up the beginning and ending tags, curly braces, and other HTML and script elements.Write modular code. Whenever possible, group your statements into functions. Functions let you group related statements, and test and reuse portions of code with minimal effort.Be consistent in the way you ...

Read More

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

Abhinaya
Abhinaya
Updated on 23-Jun-2020 373 Views

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

Read More

volatile keyword in C#

Samual Sam
Samual Sam
Updated on 20-Jun-2020 818 Views

To reduce concurrency issues in C#, use the volatile keyword. Let us seen an example.The following is how you use a volatile keyword for public variable −class Program {    public volatile int a;    public void Program(int _a) {       i = _i;    } }Let us see another example: We have two static variables. Set them in a new method −_out = "Welcome!"; _new = true;We declared them as static before using volatile −static string _out; static volatile bool new;Now you need to run the method on a thread −new Thread(new ThreadStart(volatileFunc)).Start();Read the value of the ...

Read More

Adding an element in an array using Javascript

Samual Sam
Samual Sam
Updated on 15-Jun-2020 275 Views

Adding an element to an array can be done using different functions for different positions.Adding an element at the end of the arrayThis can be accomplished using the push method. For example, let veggies = ["Onion", "Raddish"]; veggies.push("Cabbage"); console.log(veggies);This will give the output −["Onion", "Raddish", "Cabbage"]You can also use this to push multiple items at the same time as it supports a variable number ofarguments. For example, let veggies = ["Onion", "Raddish"]; veggies.push("Cabbage", "Carrot", "Broccoli"); console.log(veggies);This will give the output −["Onion", "Raddish", "Cabbage", "Carrot", "Broccoli"]Adding an element at the start of the arrayThis can be accomplished using the unshift method. ...

Read More
Showing 121–130 of 328 articles
« Prev 1 11 12 13 14 15 33 Next »
Advertisements