HTML Articles

Page 135 of 151

How to return a random number between 0 and 199 with JavaScript?

Rama Giri
Rama Giri
Updated on 20-May-2020 445 Views

To return a random number between 0 and 199, use the JavaScript Math.random() and Math.floor() method.ExampleYou can try to run the following code to return a random number in JavaScript.                    document.write(Math.floor(Math.random() * 200));          

Read More

Is it a good practice to place all declarations at the top in JavaScript?

Ayyan
Ayyan
Updated on 20-May-2020 158 Views

Yes, it is a good practice to place all the JavaScript declarations at the top. Let’s see an example −Example           JavaScript String match() Method                        // all the variables declared at top          var str, re, found;                    str = "For more information, see Chapter 3.4.5.1";          re = /(chapter \d+(\.\d)*)/i;          found = str.match( re );          document.write(found );           The following are the valid reasons −Gives a single place to check for all the variables.Helps in avoiding global variablesRe-declarations are avoided.The code is easy to read for others as well.

Read More

What will happen if a semicolon is misplaced in JavaScript?

Srinivas Gorla
Srinivas Gorla
Updated on 20-May-2020 252 Views

If a semicolon is misplaced in JavaScript, then it may lead to misleading results. Let’s see an example, wherein the if statement condition is false, but due to misplaced semi-colon, the value gets printed.Example                    var val1 = 10;          if (val1 == 15) {             document.write("Prints due to misplaced semi-colon: "+val1);          }          var val2 = 10;          if (val2 == 15) {             // this won't get printed             document.write(val2);          }          

Read More

How to use the formmethod attribute in HTML?

Nancy Den
Nancy Den
Updated on 14-May-2020 224 Views

The formmethod attribute is used to define the HTTP technique for sending form information. This method is usedwith input type submit a picture. It overrides the method attribute of HTML forms.ExampleYou can try to run the following code to learn how to use the formmethod attribute in HTML.           HTML formmethod attribute                        Student Name          Student Subject                              

Read More

Why do we use the novalidate attribute in HTML?

Arushi
Arushi
Updated on 14-May-2020 6K+ Views

The novalidate attribute in HTML is used to signify that the form won’t get validated on submit. It is a Boolean attribute and useful if you want the user to save the progress of form filing. If the form validation is disabled, the user can easily save the form and continue & submit the form later. While continuing, the user does not have to first validate all the entries.ExampleYou can try to run the following code to learn how to use novalidate attribute in HTML. In the following example, if you will add text in the  field, then it won’t show ...

Read More

Which is the best tutorial site to learn HTML?

Nikitha N
Nikitha N
Updated on 08-May-2020 220 Views

HTML stands for Hyper Text Markup Language, which is the most widely used language on Web to develop web pages. HTML was created by Berners-Lee in late 1991 but "HTML 2.0" was the first standard HTML specification which was published in 1995. HTML 4.01 was a major version of HTML and it was published in late 1999. However, HTML 4.01 version is widely used but currently we are having HTML-5 version, which is an extension to HTML 4.01, and this version published in 2012.To learn HTML, refer HTML tutorial. It explains the below given HTML concepts perfectly:HTML Basic TagsElementsAttributesHTML Phrase ...

Read More

Parse HTML with PHP's HTML DOMDocument

AmitDiwan
AmitDiwan
Updated on 07-Apr-2020 561 Views

The text inside a tag inside class="text" inside with class="main" can be obtained with the following code − Example $html = nodeValue)); } Output This will produce the following output − string 'This is text 1' (length=14) string 'This is text 2' (length=14)

Read More

How to use a novalidate attribute in HTML?

Abhinanda Shri
Abhinanda Shri
Updated on 12-Mar-2020 437 Views

The novalidate attribute in HTML is used to signify that the form won't get validated on submit. It is a Boolean attribute. You can try to run the following code to learn how to use novalidate attribute in HTML. In the following example, if you will add text in the field, then it won't show an error. Example           HTML novalidate attribute                         Student Name          Rank                     

Read More

HTML5 Canvas layer disappears on mouse click in Fabric.js and Firefox stops responding when creating a canvas for the image?

karthikeya Boyini
karthikeya Boyini
Updated on 04-Mar-2020 528 Views

If the HTML5 Canvas layer disappears on mouse click in Fabric.js and Firefox stops responding when creating a canvas to the image, then there is a way to drag and drop images from your computer to canvas using Fabric.This can be done by making image draggable property to true by this way −

Read More

Phonegap + Windows Phone 8 : HTML5 viewport meta & scaling issue

karthikeya Boyini
karthikeya Boyini
Updated on 04-Mar-2020 156 Views

Whenever you face such issue, it would mean you have not written the CSS properly.Just add the following in CSS −* {    zoom:1;    -ms-content-zooming:none; }For some code, even the following works −@viewport {    width:320px; } @-ms-viewport {    width:320px;    zoom-user:fixed;    max-zoom:1;    min-zoom:1; }

Read More
Showing 1341–1350 of 1,508 articles
« Prev 1 133 134 135 136 137 151 Next »
Advertisements