Home > DeveloperSection > Interviews > How to write messages to the screen without using "document.write()"?

Posted on    March-18-2011 12:00 AM

 JavaScript JavaScript 
Ratings:
 1 Answer(s)
  1339  View(s)
Rate this:

Amit Singh

Total Post:565

Points:2825
Posted on    March-18-2011 12:00 AM

 When the method showStatus is invoked it will change the content of the span.
Example:
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>

Don't want to miss updates? Please click the below button!

Follow MindStick