In the previous example, we saw that JavaScript can be used to generate the text of a Web page. JavaScript can work with all of the elements of a Web page, not just the actual text that is diplayed. We can use JavaScript to make the page's display change dynamically in response to the user.

Click here for the next example.

Here's the source:

<html> 
<head> 
</head>
<body> 

This is just some text that might be on the page.
<br /> 

I hope you are enjoying this.
<br /> 

We are going to have fun with it.


<script type="text/javascript"> 

	color = prompt("Choose a color (red, yellow, blue):")
	document.bgColor = color;

</script> 
</body> 
</html>