In this article we will learn about some of the frequently asked HTML programming questions in technical like “innerHTML” Code Answer’s. When creating scripts and web applications, error handling is an important part. If your code lacks error checking code, your program may look very unprofessional and you may be open to security risks. Error or stack handling on html was simple and easy. An error message with filename, line number and a message describing the error is sent to the browser. This tutorial contains some of the most common error checking methods in HTML. Below are some solution about “innerHTML” Code Answer’s.
change innerhtml
xxxxxxxxxx
1
document.getElementById("p1").innerHTML = "New text!";
.innerhtml
xxxxxxxxxx
1
// .innerHTML method is used to change the html contents of a DOM object
2
document.getElementById("demo").innerHTML = "Paragraph changed!";
javascript innerhtml
xxxxxxxxxx
1
document.getElementById("example").innerHTML = "Paragraph changed!";
js innerHTML
xxxxxxxxxx
1
document.getElementById("Test").innerHTML = "<p style='color:red;'>Test</p>";
innerHTML
xxxxxxxxxx
1
document.getElementById("Test").innerHTML = "<h1>Test</h1>";
innerhtml in javascript
xxxxxxxxxx
1
<p id="demo" class="demo_class"></p>
2
3
<script>
4
//simple
5
document.getElementById("demo").innerHTML = "hello World";
6
7
//advance
8
document.getElementById("demo").innerHTML = person("ahsan", "21");
9
10
function person(name1, age1) {
11
return ("Your name is " + name1 + ". You're " + age1 + " years old.");
12
}
13
14
</script>