WolfShield,
The main thing is that the javascript runs as the page loads before the browser has had a chance to convert the HTML into DOM elements and then rendered them. You need to cast the code inside an "onload handler", which runs after the page has loaded.
Another thing is that document.getItemById should be replaced with document.getElementById (twice).
window.onload = function() {
var name = prompt("What is your name?","John");
if (name) {
document.getElementById("helloText").innerHTML='Hello ' + name + '!';
} else {
document.getElementById("helloText").innerHTML='None';
}
};
I haven't test this but think it should work.Airshow
Airshow
WiFi Lounge Lizard
2,683 posts since Apr 2009
Reputation Points: 321
Solved Threads: 372