Well.. maybe it's a little scary...
However, this bit of javascript you just saw isn't! It's easy, and works well across platforms...
Let's look at the code.
Most javascript lives between the title tag and the close head tag, rather than in the body. It can live in the body sometimes, but we'll get to that later.
First we tell the browser what this is
<script language="JavaScript">Then, if we are nice, we add a comment to show what we are doing. JavaScript comments have a different code than html. in html is it
but in Javascript it is either two double slashes to comment one line, or a star slash */ at the beginning and the end of the code like so
*/ I'm trying to write cool javascript, don't laugh at me!/*
//put up an alert box, to show how they work
Finally, the actual code. alert is the little box you just saw. in the parenthesis we write what we want the alert to contain. and all javascript lines are ended with a semicolon. so there it is.
alert("JavaScript isn't scarey!");and finally, we have to end our script, so our browser knows to go back to reading html.
</script >And there it is! Now you try it!