<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>test</title>
<script type="text/javascript">
window.onload = function(){
document.getElementById("myMessage").innerHTML = "hello,world!";
}
</script>
</head>
<body>
<h1 id=="myMessage"></h1>
</body>
</html>
when i run the file, there is no hello,world! output. why?
Your script block shoul be in the<head>or<body>, not outside either.It’s hard to keep track of your question with you editing it every 20 seconds.
Your latest problem appears to be this
It should be
Demo here – http://jsfiddle.net/3Xzka/