ok im new at javascript, but im trying to change the innerhtml of a div tag, heres my script and its not working:
Rather than assigning var1
to window.onload
, you're currently calling the function and storing its result. Also, this might be obvious, but var1
seems like an odd name for a function. Try this:
function var1() {
document.getElementById('text').innerHTML = 'hi';
}
window.onload = var1;
Note the casing of onload
, as well as the missing parentheses after var1
.