You cannot document.write to the page once it is loaded without overwriting it. There are various ways to carry out what you seem to want to do (which in itself isn't entirely clear). Here's one:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
#hding {
display:none;
}
</style>
<script type="text/javascript">
function message(color){
var h=document.getElementById('hding').style;
h.color=color=='r'? 'red' : color=='g'? 'green' : 'blue';
h.display='block';
}
</script>
</head>
<body>
<div>
<a href="javascript:message('r')">Red</a> <a href="javascript:message('g')">Green</a>
<a href="javascript:message('b')">Blue </a>
</div>
<h2 id='hding'>Hello World!</h2>
</body>
</html>
Bookmarks