Found 2416 Articles for HTML

Content Spoofing

Sunidhi Bansal
Updated on 04-Aug-2020 13:37:59

445 Views

Content Spoofing is the term used to define the type of attack by malicious programmers in which they present a fake website as a legitimate one to the user by text injection or html injection. When a web application does not properly handle the data supplied by the user using search etc. then the attacker can take advantage of such a situation and inject additional parameters that go unnoticed by the user. This leads to landing on another web page that looks the same as the original webpage. That page can ask the user to input information which is confidential ... Read More

How to embed JavaScript in HTML file?

AmitDiwan
Updated on 17-Jul-2020 08:20:18

415 Views

Following is the code to embed JavaScript in html file −Example Live Demo Document    body {       font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;    }    .result {       font-size: 18px;       font-weight: 500;       color: rebeccapurple;    } Embed javascript in html file    let resEle = document.querySelector(".result");    resEle.innerHTML += "Inline javaScript loaded" + ""; script.jsresEle.innerHTML += 'External JavaScript loaded ';OutputThe above code will produce the following output −

Adding default search text to search box in HTML with JavaScript?

AmitDiwan
Updated on 16-Jul-2020 12:38:14

418 Views

You can use the concept of placeholder. Following is the JavaScript code −Example Live Demo Document    var yourText= "John";    var textBoxSearch = document.getElementById("textSearch");    textBoxSearch.value = yourText;    textBoxSearch.onfocus = function() {       if (this.value == yourText) {          this.value = '';       }    } To run the above program, save the file name anyName.html(index.html) and right click on the file and select the option open with live server in VS Code editor.OutputWhen you click on the search box, the placeholder value will be visible. The snapshot is as follows −

Add oninput attribute to HTML element with JavaScript?

AmitDiwan
Updated on 16-Jul-2020 06:54:17

471 Views

For this, use the concept of document.getElementById() along with addEventListener(). Following is the JavaScript code −Example Live Demo Document Enter the value:    document.getElementById('enterValue').addEventListener("input", function () {       console.log('you have entered the value');    }); To run the above program, save the file nameanyName.html(index.html) and right click on the file and select the option open with live server in VS code editor.OutputWhen user enters a value −

Difference Between HTML and ASP.

Nitin Sharma
Updated on 09-Jun-2020 07:56:00

1K+ Views

Both HTML and ASP are the web development languages and are widely used in developing web server pages and applications.On the basis of nature of both of the languages we can distinguish between HTML and ASP as follows −Sr. No.KeyHTMLASP1DefinitionHTML is a client-side language which mainly use for developing user interface.HTML stands for Hypertext MarkUp Language in which "Hypertext" refers to the hyperLinks that an HTML page may contain and "MarkUp language" refers to the way tags are used to define the page layout and elements within the page.On other hand ASP is a server-side language developed by Microsoft i.e., ... Read More

How to create a download link with HTML?

AmitDiwan
Updated on 08-May-2020 14:15:52

665 Views

To create a download link with HTML, the code is as follows −Example Live Demo Download Link example Click on the image above to download it OutputThe above code will produce the following output −

How to sort an HTML table using JavaScript?

AmitDiwan
Updated on 09-Nov-2023 14:46:38

1K+ Views

To sort an HTML table using JavaScript, the code is as follows − JavaScript function to sort an HTML Table Consider the following sort function using JavaScript, that will be used to sort an HTML table.   function sortTable() {     var filterTable, rows, sorted, i, x, y, sortFlag;     filterTable = document.querySelector(".filterTable");     sorted = true;     while (sorted) {      sorted = false;      rows = filterTable.rows;      for (i = 1; i < rows.length - 1; i++) { ... Read More

How to sort an HTML list using JavaScript?

AmitDiwan
Updated on 06-May-2020 14:29:47

876 Views

To sort an HTML list using JavaScript, the code is as follows −Example Live Demo Sorting list example Click to sort Giraffe Camel Dog Lion Cheetah Cat    document .getElementsByTagName("button")[0] .addEventListener("click", sortList);    function sortList() {       var list, i, sortFlag, LiEle, sorted;       list = document.querySelector(".animalList");       sortFlag = true;       while (sortFlag) {          sortFlag = false;          LiEle = list.getElementsByTagName("LI");          for (i = 0; i < LiEle.length - 1; i++) {         ... Read More

How to create a file upload button with HTML?

AmitDiwan
Updated on 21-Nov-2023 21:12:19

1K+ Views

To create a file on upload button with HTML, the code is as follows −Example File upload button example Click on the "Choose File" button to upload a file: OutputThe above code will produce the following output −On clicking the “Choose file” button −

How to turn off spell checking (grammar correction) for HTML form elements?

AmitDiwan
Updated on 06-May-2020 14:07:54

114 Views

To turn off spell check for form elements, the code is as follows −Example Live Demo Disabling Spellcheck Example Your Name: About Yourself Type wrong spelling in the above input field to see spellcheck in action OutputThe above code will produce the following output −On typing something in the input fields −

Advertisements