Run Scripts |
This lesson is about the fun elements of beginning JavaScript. I would suggest opening the Run Scripts page in another window to try out some of the scripts as you go along.
Remember, to use a script in a real web page you need to add
<script type="text/javascript">and
</script>tags around the script. Both the beginning and ending tags are required. Previously, the script type was set using a language attribute rather than the type attribute.
Script # 1
Alert a message
This is a simple method used to alert a warning or other message to the user. The syntax is simple.
alert('MESSAGE_GOES_HERE_BETWEEN_QUOTES');
alert('Hi! Welcome to the World of JavaScript!');
Now try to create a message in a alert box that says
Hello, my name is YOUR_NAMERemember to put your name where it says YOUR_NAME.
MyersDaily created by Joseph K. Myers 1999-2000. Free hosting by Angelfire!!Terms-of-Service |