To write messages to the screen without using "document.write()"?
Submitted by: AdministratorChanging the contents of an element is a much better solution. When the method showStatus is invoked it will change the content of the span.
function showStatus(message) {
var element = document.getElementById("mystatus");
element.textContent = message; //for Firefox
element.innerHTML = message; //for IE (why can't we all just get along?)
return true;
}
<span id="mystatus">Test. </span>
Submitted by: Administrator
function showStatus(message) {
var element = document.getElementById("mystatus");
element.textContent = message; //for Firefox
element.innerHTML = message; //for IE (why can't we all just get along?)
return true;
}
<span id="mystatus">Test. </span>
Submitted by: Administrator
Read Online JavaScript Job Interview Questions And Answers
Top JavaScript Questions
☺ | To write messages to the screen without using "document.write()"? |
☺ | What and where are the best JavaScript resources on the Web? |
☺ | How to convert numbers to strings using JavaScript? |
☺ | How do you convert numbers between different bases in JavaScript? |
☺ | How to write a script for "Select" lists using JavaScript? |
Top Top World Wide Web Categories
☺ | Cascading Style Sheet CSS Interview Questions. |
☺ | HTML5 Interview Questions. |
☺ | Basic Internet Interview Questions. |
☺ | Domain Name System (DNS) Interview Questions. |
☺ | JavaScript Interview Questions. |