Javascript Tutorial I – Hello World!
1 minute read
I see you are back at ByteRevel, and for a good reason. You are interested in the art of Javascripting your HTML page! Well, we cannot progress any further till you have mastered the Hello World! program. You will be punished if progressing without consulting Hello World.
Let’s take a look at the coding for Hello World! Note that the HTML is in the strange font and the Javascript is bolded.
**<script type=”text/javascript”>**
**document.write(“Hello World!” )**
**</script>**
</HTML**>**
You HTML programmers would understand the basic template for creating a Body and Heading and all that happiness. But once you look at the Javascript, you’ll realize that using the function provided is just wasting your time. And that is true. **document.write** makes no difference, even if you were using just HTML to write “Hello World.” You should realize **document.write** will only make your life easier if you plan to use more Javascript.
Another way of displaying “Hello World” on your Hello World! document is by creating a box so that when one types in “Hello World!” it will display, Hello World!
**<SCRIPT Language =”JavaScript” >**
**function MsgBox (textstring) {**
**alert (textstring) }**
**</SCRIPT>**
****
</HTML**>**
This allows the user to just type in his what-not and display it. We are hoping this person will type “Hello World” and not something obscene.
You may notice the other part of the Javascript has some strange inputs and names and other pieces of information that seem convoluted at the moment (if it doesn’t, you are either lying, know Javascript already, or just are very observant; I am guessing the third one). But I will re-post another Javascript tutorial later on, explaining how this works.
One of the many Javascript Logos
Leave a Comment