Script Value

Hello

I want do appear text in div with class name “example”…i try two methods but… with this method don’t work i don’t know why, but with the method below works. (I’m going get the file .js correctly.)
Anyone knows the problem?

<html>
<head>
<script type="text/javascript" src="/js/phases.js"></script>
</head>
<body>
<div class="example"><script>document.write(mensage[rand]);</script></div>
</body>
</html>
<html>
<head>
<script type="text/javascript">
   var mensage = new Array(
   'example',
   'example2',
   var rand = Math.floor(Math.random() * 2);
</script>
</head>
<body>
<div class="example"><script>document.write(mensage[rand]);</script></div>
</body>
</html>

Thanks!

In the second example, you need to close the mensaje Array after element2.

Why are you writing JavaScript for Netscape 4 and earlier browsers. The document.write statement should not be used for more modern browsers such as Internet Explorer Five.