S
Steve
The following javascript file works:
window.onload = writeMessage;
function writeMessage() {
document.getElementById("helloMessage").innerHTML = "bottom";
}
But when I pass a value to the event handler like this:
window.onload = writeMessage("bottom");
function writeMessage(text) {
document.getElementById("helloMessage").innerHTML = text;
}
I get the error "document.getElementById("helloMessage") has no
properties"
How can I pass a value to the event handler?
window.onload = writeMessage;
function writeMessage() {
document.getElementById("helloMessage").innerHTML = "bottom";
}
But when I pass a value to the event handler like this:
window.onload = writeMessage("bottom");
function writeMessage(text) {
document.getElementById("helloMessage").innerHTML = text;
}
I get the error "document.getElementById("helloMessage") has no
properties"
How can I pass a value to the event handler?