Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.

Els1 Basic To Javascript (EBTJ)


Els1 Basic To Javascript (EBTJ)

By ghostghost | 4857 Reads |
0     0

[size=5]Els1 Basic To Javascript (EBTJ)[/size]

Hello im Els1 and what your about to read is a language called Javascript. Javascript is not related to Java their both different languages. Now lets begin.

[size=3]Making a script block[/size]

  1. You need to use the 'script' tag to open and close javascript codes.
 javascript code has to go here
</script>```

2. Now for the \'*script*\' tags we need to put \'*javascript*\' as the language in, so we will be adding this code:

```markuplanguage=\"Javascript\"```

to the \'script\' tag.

so it should look like this now:

```markup<script language=\"Javascript\">

 javascript code has to go here

</script>```

**[size=2]Now ill be teaching you how to add html to the script block.[/size]**

Frist off open a html page.

1. Now lets make the body:

```markup<body>

</body>```

2. Lets add the \'script\' tags to put the javascript in:

```markup<body>
 <script>

 </script>
</body>```

3. Now lets make Javascript the language by adding it like last time:

```markup<body>
 <script language=\"Javascript\">

 </script>
</body>```
 
4. Lets add the code for it to make it show \'hello\' here it is:

```markupdocu<i></i>ment.write(\"hello\");```

once added to the other codes it should look like this:

```markup<body>
 <script language=\"Javascript\">

 docu<i></i>ment.write(\"hello\");
 
 </script>
</body>```

remember you can change \'*hello*\' to anything. 

5. Adding HTML comments makes you use this \'<!--\' and \'// -->\' now once added to the above it should look like this:

```markup<body>
 <script language=\"Javascript\">
<!--

 docu<i></i>ment.write(\"hello\");

 // -->
 </script>
</body>```

The not so good thing about the HTML comment code is that if your browser doesnt support Javascript you wont see anything just blank, I use Explore so I can view javascript.

**[size=3]Working with the noscript tag[/size]**

In this area we will make the scrip block again **BUT** were going to use the \'noscript\' tag. The \'noscript\' tag is used for browsers that dont view javascript, so with this code it makes them see javascript. So lets start on it:

First open a html page.

1. Lets add the body:

```markup<body>

</body>```

2. Put the script with the language:

```markup<body>
<script language=\"Javascript\">

</script>
</body>```

3. Now throw in the HTML comment and the \'*hello*\' command:

```markup<body>
<script language=\"Javascript\">
<!--

docu<i></i>ment.write(\"hello\")

// -->
</script>
</body>```

4. After all of that at the bottom add the \'noscript\' tag:
Heres it alone:
```markup<noscript>
</noscript>```

now here it is with the other codes together:

```markup<body>
<script language=\"Javascript\">
<!--

docu<i></i>ment.write(\"hello\")

// -->
</script>
</body>

<noscript>
This is for non javascript user
</noscript>

OK if your browser can view javascript you will see the 'hello' and if you go to browser that doesnt view javascript you will see 'This is for non javascript user'.

[size=3]Working with the One line and Multiline comments[/size]

Working with the One line and Multiline comment is pretty easy codes not that hard to remember.

Here is the code for the One line comment:

markup// This is a one-line comment

Here is the code for the Multiline:

This is a multiline
comment
*/```

once you add them make then be in the \'*script*\' tags. 

**[size=3]Adding more than one command and removing a command[/size]**

For this one where going to add more then on command. For the more the one command to work where going to use the semi colon. So its back to using this code again:

```markupdocu<i></i>ment.write(\"hello\")```

now lets add a second and third command it could be anything.

```markupdocu<i></i>ment.write(\"hello\")
docu<i></i>ment.write(\" world\")
docu<i></i>ment.write(\".\")```

lets add it with the script box to look like this:

```markup<body>
<script language=\"Javascript\">
<!--

docu<i></i>ment.write(\"hello\")
docu<i></i>ment.write(\" world\")
docu<i></i>ment.write(\".\")

// -->
</script>
</body>```

Now on the web page it will look something like this \"hello world.\" simple:).

Now its time to tell you how to remove a command line with leaveing the code their. Where going to work with this code:

```markup//```

Looks like this code can not do anything but it can remove a command. Ok lets say we dont want it to say \'world\' this is how the code will be:

```markup<body>
<script language=\"Javascript\">
<!--

docu<i></i>ment.write(\"hello\")
// docu<i></i>ment.write(\" world\")
docu<i></i>ment.write(\".\")

// -->
</script>
</body>```

Now the web page will say \'Hello.\' the \'world\' wont be included.

Im still goin to update this topic because their is alot more

Thanks for reading by Els1.
This is ©® of Els1 2006

Comments
ghost's avatar
ghost 18 years ago

Thnaks dude helped loads

ghost's avatar
ghost 18 years ago

ur welcome if theirs <i></i> in the code take it off the code sorri dont know how it came up

ghost's avatar
ghost 18 years ago

  1. Now lets make the body:

…… lol wtf :P ? n nice article btw :)

ghost's avatar
ghost 18 years ago

Go els! :D