Javascript Basics
1,870 ViewsJavascript Tutorials April 5th, 2007
Hi, in this tutorial hopefully you will learn the basics of javascript.
First thing to know is javascript is a Client-Side programming language. That means it uses the users web browser to run the code. Second thing to know is there are TWO ways of including javascript in your web pages.
- The first way to include it in your page is to use script tags, for example:
Take your basic HTML page structure:HTML:-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
<html xmlns="http://www.w3.org/1999/xhtml">
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
-
<title>Add your name to our database</title>
-
</head>
-
-
</body>
-
</html>
The, find the head tag and inside it add:
HTML:-
<script type="text/javascript">
-
//Code goes here
-
</script>
-
-
The second way is to link to external jscript file. First thing create your file.js then in the head tag of the page you want to link it to add this:
HTML:
-
<script type="text/javascript" src="file.js"></script>
If you want to link it to a file on an external website:
HTML:-
<script type="text/javascript" src="http://www.tutorialcode.com/file.js"></script>
-
-
<script type="text/javascript">
-
document.write("Hello, world!")
-
</script>
Now let's start on some code. Say you want your website viewers to have javascript to view your content, you would use the document.write command. So in your head tag of your html page add this:
Note: You do not have to add the ; on the end of javascript commands. The above code would write: Hello, world!
Hopefully now you have some basic understanding of javascript, I may build on this and move on to move advanced stuff some time.
Thanks for reading ![]()
Mortisimus
http://www.flashdoom.net


(8 votes, average: 3.63 out of 5)










April 5th, 2007 at 10:29 pm
You made a little boo-boo, I changed it though. You said javascript was server side, when it is client side
April 9th, 2007 at 1:49 pm
oh ok
April 28th, 2007 at 8:05 pm
Not to be rude or something but I wouldn't call it basics. A tutorial of JS basics would be much detailed and would contain much more.
Btw javascript mustn't be place between the tags...
May 21st, 2007 at 11:20 pm
I love the content. Just a bit of advice. The viewing size for the code windows are extremely small. It's a bit of an annoyance to have to scroll around the window to view the code in its entirety, and the fact that the entire section of code cannot all be seen at once. The content area of your site is taking up about 50% of the viewable page. I think you should use the extra room you have and expand it.