Html

Solo disponible en BuenasTareas
  • Páginas : 2 (456 palabras )
  • Descarga(s) : 0
  • Publicado : 21 de marzo de 2011
Leer documento completo
Vista previa del texto
Let's start with a traditional Hello World! Seems every programming tutorial begins with that.

Copy the following and save as hello.html..



Then add SCRIPT and comment tags within theHEAD section. These do a few things. The script tags tell the browser that some sort of scripting is contained between (in this case "javascript"). It also contains HTML comments so older or non-JScapable browsers will ignore the scripting contained within. The last thing is a javascript comment (//) which we will learn about later.



Now we'll make a function. A function does something. Itexecutes a series of instructions. We'll start with an empty shell...



Now we'll add the function name and an alert box that say's "Hello World!"...



Notice how the function isstructured. The word function declaring that it is in fact, a function. The function name - HelloWorld. The parentheses ( ), these have a use that we'll get into later, and the curly brackets - { } thatcontain the set of instructions.

So, that's it for the function in the head tags. It's just sitting there waiting for something to call it. How about we make it execute when we click on a link? Soundsgood to me. Here's a generic link that points nowhere for now...

Hello



Make it point to the function...

Hello



Now try it.

Well, whaddya know about that? Your firstjavascript.

Before we go on, there's something else we should make clear. Javascript and Java are two completely different things. What we just did is Javascript, NOT Java. Java is a whole nuther thing.The only real thing the two have in common are the letters J-A-V-A in their name. Long long ago, Netscape made a new scripting language for their browser. They called it LiveScript. About that time,the Java programming language was gaining in popularity so the folks at Netscape renamed their scripting language to JavaScript to catch the Java wave. The two have been confused ever since. To add to...
tracking img