First off, it's called Javascript ;). Java and Javascript are VERY different programming languages. Java is a lot more complex/powerful. Javascript is a web-based scripting language.
Anyway, to make a message box(alert) in javascript, on a webpage, you would go like so.
Code:
<script type="text/javascript">
alert("Why hello there.");
</script>
If you want to do inline javascript(in your address bar/or make put it in the href attribute of an <a> tag) then it goes like this.
Code:javascript:alert("hello");
If you want more help with javascript, you can go to www.w3schools.org. They're the guys who set the standards for web related stuff.