Found 2416 Articles for HTML

HTML DOM console.clear() Method

AmitDiwan
Updated on 08-Aug-2019 11:36:22

621 Views

The HTML DOM console.clear() method is used to clear the console. The console.clear() method will also write “Console was cleared” message in the console and clears all the previous console content. This method is fully supported by all the browsers.SyntaxFollowing is the syntax for console.clear() method −console.clear()ExampleLet us see an example for the HTML DOM console.clear() method − JavaScript console.clear() Method Press F12 on the keyboard to see the message on your console console.log("TEXT has been printed on the console!"); Click the below button to clear the console CLEAR    function clearConsole() {       console.clear(); ... Read More

HTML DOM console.assert() Method

AmitDiwan
Updated on 07-Aug-2019 14:26:18

73 Views

The HTML DOM console.assert() method is used to write a message to the console only if the first expression supplied to it is false. These messages are intended for user to see. The expression as well as the displaying message are sent as first and second parameters to the console.assert() method respectively.SyntaxFollowing is the syntax for console.assert() method −console.assert(assertion, msg);Here, assertion is any expression that returns boolean true or false. The msg is a JavaScript string or an object. The assertion should be false to display the msg on console.ExampleLet us see an example for the console.assert() method − ... Read More

HTML DOM compareDocumentPosition() Method

AmitDiwan
Updated on 07-Aug-2019 14:23:03

42 Views

The HTML DOM compareDocumentPosition() method is used to compare a given node position to any other node in any document. The return type of this method is of type integer to describe their position in the document. The integer return values are as specified −1: No relationship, the two nodes do not belong to the same document. 2: The first node (para1) is positioned after the second node (para2). 4: The first node (para1) is positioned before the second node (para2). 8: The first node (para1) is positioned inside the second node (para2). 16: The second node (para2) is positioned ... Read More

HTML DOM ColumnGroup span Property

AmitDiwan
Updated on 07-Aug-2019 14:19:44

67 Views

The HTML DOM ColumnGroup span property is associated with the span attribute of the HTML element. The ColumnGroup span property set or returns the value of the span attribute of a column group. The span attribute is used to define the number of columns a element should span to.SyntaxFollowing is the syntax for −Setting the ColumnGroup span property −columngroupObject.span = numberHere, the number specifies the number of columns the element should span to.ExampleLet us look at an example for the ColumnGroup span property −    table, th, td {       border: 1px ... Read More

HTML DOM ColumnGroup object

AmitDiwan
Updated on 20-Feb-2021 05:48:37

72 Views

The HTML DOM ColumnGroup object is associated with the HTML element. The element is used to apply CSS styles to a specific number of columns or all columns. This gives us a greater control on the columns that are present in a table.PropertiesFollowing is the ColumnGroup property −PropertyDescriptionspanSets or returns the value of the span attribute of a column groupSyntaxFollowing is the syntax for −Creating a ColumnGroup object −var x = document.createElement("COLGROUP");ExampleLet us see an example for the ColumnGroup object −Live Demo    table, th, td {       border: 1px solid black;   ... Read More

HTML DOM Column span Property

AmitDiwan
Updated on 20-Feb-2021 05:50:32

146 Views

The HTML DOM Column span property is associated with the colspan attribute inside the element in the HTML. Using the colSpan property we can set or return the colspan attribute of a table. The colspan attribute is used to create the no. of columns that a table should span to.SyntaxFollowing is the syntax for −tabledataObject.colSpan = numberHere, number represents the number of columns the table should span to.ExampleLet us see an example for the colSpan property −Live Demo table, th, td {    border: 1px solid blue; } Monthly Savings Month ... Read More

HTML DOM Column object

AmitDiwan
Updated on 20-Feb-2021 05:51:55

75 Views

The HTML DOM Column object is associated with the HTML element. The Column object is used to get or set the properties of element. The tag is used only inside a element.PropertiesFollowing is the property for column object −PropertyDescriptionSpanTo set or return the span attribute value of a column.SyntaxFollowing is the syntax for −Creating a Column object −var a = document.createElement("COL");ExampleLet us see an example for the column object −Live Demo    table, th, td {       border: 1px solid blue;    }    #Col1{       background-color:pink;    } ... Read More

HTML DOM Code object

AmitDiwan
Updated on 20-Feb-2021 05:53:21

90 Views

The HTML DOM Code object is associated with the HTML 5 tag. It is used for marking up a piece of code by surrounding it inside the element. The Code object basically represents element.SyntaxFollowing is the syntax for −Creating a code object −var a = document.createElement("CODE");ExampleLet us see an example for the HTML DOM code object −Live Demo Click the below button to create a CODE element with some text CREATE    function createCode() {       var x = document.createElement("CODE");       var t = document.createTextNode("print('HELLO WORLD')");       x.appendChild(t); ... Read More

HTML DOM close() method

AmitDiwan
Updated on 20-Feb-2021 05:54:45

188 Views

The HTML DOM close() method is used to close the output stream. It is done to indicate that writing on the window has been finished. It doesn’t take any parameter and displays all the previous data before closing.SyntaxFollowing is the syntax for HTML DOM close() method −document.close()ExampleLet us see an example for the close() method −Live Demo Click the below button to open an output stream put some text in it and finally close it. CLOSE STREAM    function streamClose() {       document.open();       document.write("SAMPLE HEADING");       document.write("SAMPLE HEADING 2");   ... Read More

HTML DOM cloneNode() method

AmitDiwan
Updated on 20-Feb-2021 05:56:16

247 Views

The HTML DOM cloneNode() method is used for creating a copy of a given node on which cloneNode() method is called upon and it returns the clone. The cloneNode() method clones all the attributes and values of a given node.SyntaxFollowing is the syntax for cloneNode() method −yourNode.cloneNode([deep])Here, deep is an optional parameter. By setting its value true we specify that the given node and its children along with their attributes and values should be cloned and by setting its value false we specify that we only want to copy the given node and its attributes and values and not its ... Read More

Advertisements