It appears you have not yet registered with our community. To register please click here.

Origin XT RPG Network Home

Javascript Tutorial


Jul 25 2005, 04:13 AM (Post #1)
General
* * * * * * *
Posts: 4,937
Cash: 29,817,448 / 68,857,771
Group: Representative
Joined: 11/26/02 02:31 AM
Be humble.. I am tired and I just started writing this... I'll fix anything tomorrow.

!!!!IMPORTANT!!!!

Don't post here! Go do it in the javascript thread, so you're not cluttering up the tutorial.

Ahem...

Javascript is a client side script primarily used to integrate dynamic events to your website. It has the ability to process forms, call variables, manipulate what is shown on the windows and more. For now, I will cover the very basics of Javascript, up to the point where you can begin using it in your own website.


Lets start off all official-like...


Lesson 1 - Your First Code


To start off, the best way to learn any programming language is to practice. Write it out on pad and pen, type statements over and over, just to get the feel for it. But don't let me force you. Take any approach you want, whatever suits your needs and wants.

Everything about Javascript is written in statements, or, to state cause and effects, in short. For general purposes, take a look at the simple page source below:


CODE


<html>

<head>
<title>My Page</title>
</head>

<body>


<script language="JavaScript">

var message = ("I am the Chicken Man!!");
document.writeln(message);

</script>


</body>

</html>



This is just like a typical website source you would see, with one exception: it has a new tag, and some lines of coding inbetween. All Javascript goes inbetween the <script> and </script> tags. Also, but there are a couple exceptions, all lines end with a semicolon.
; <-- One of those doohickies

Now, let's take a closer look at the Javascript section of the page...

CODE



var message = ("I am the Chicken Man!!");
document.writeln(message);




These are two relatively common lines that you can find in a jscript code. Let's go over each line individually...


var message = ("I am the Chicken Man!!");

var is the beginning of a variable statement, which holds information until it needs to be used at a later time.

message is simply the name of the variable that you are declaring. It can be pretty much anything, but a couple rules of thumb to follow are that it must start with a letter, and it can only contain alphanumeric characters (a-z and 0-9). It may also contain an underscore ( _ ).

= is simply an equals sign. Henceforth, anything after it is what message equals.

("I am the Chicken Man!!") This is a substring, which holds various information that a function, class or anything else needs. In a variables case, it contains whatever the variable is equal to. Note that in Javascript, unlike math class, a variable can be more than just a number, it can be virtually anything.

Then we end the variable statement with a semicolon.


Now for the second line.

document.writeln(message);

document.writeln is a function that writes to the document where it was placed. The (message) section is merely what is written.

Notice that I am calling the variable message to be written. If you wanted to write something out with document.writeln without the use of a variable, all you would do is...

document.writeln("Use quotation marks");


With that, I will leave you. I am damned tired right now, so I'll come back tomorrow and finish up this tutorial, as well as organize it, check for errors etc.

Ciao.
Post Options

 
Feb 12 2006, 05:45 AM (Post #2)
(Absolute Knowledge)
* *
Posts: 179
Cash: 24,781 / 0
Group: Citizen
Joined: 2/12/06 04:51 AM
Not bad for a quicky..
But, it's been a year and no Kiro bigeyes.gif
Anyway, if you guys wanna learn more JavaScript:
http://www.javascriptmall.com/learn/contents.htm
Good site. 14 in-depth lessons, with extras. If you are serious about learning JavaScript, you might want to check out that site.

~Wise Man

This post has been edited by Wise Man: Feb 12 2006, 05:46 AM
Post Options

Feb 14 2006, 03:36 AM (Post #3)
General
* * * * * * *
Posts: 4,937
Cash: 29,817,448 / 68,857,771
Group: Representative
Joined: 11/26/02 02:31 AM
you know, I was on this page yesterday, thinking about updating it, but figured it'd be easier for everyone to just go somewhere else.
Post Options

Feb 14 2006, 08:18 PM (Post #4)
(Absolute Knowledge)
* *
Posts: 179
Cash: 24,781 / 0
Group: Citizen
Joined: 2/12/06 04:51 AM
You can teach me java if you want... Let this be where you teach me java, please ^^ We can go one lesson at a time, and stuff. It'll be fun sbiggrin.gif
Post Options

Feb 15 2006, 07:41 AM (Post #5)
Not Odd anymore
* * * * * * * * * *
Posts: 45,875
Cash: 1,915,578 / 1,817,041,051
Group: Administrator
Joined: 7/10/02 09:48 PM
You mean JS? o_O Duke's the only one proficient with Java. *cough* Haven
Post Options

Feb 16 2006, 12:53 AM (Post #6)
(Absolute Knowledge)
* *
Posts: 179
Cash: 24,781 / 0
Group: Citizen
Joined: 2/12/06 04:51 AM
I know Java.... And Java is different from JavaScript. Kiro knows JavaScript, so he can teach it to me.
Post Options

Feb 16 2006, 01:36 AM (Post #7)
Not Odd anymore
* * * * * * * * * *
Posts: 45,875
Cash: 1,915,578 / 1,817,041,051
Group: Administrator
Joined: 7/10/02 09:48 PM
o_o You said Java up there...
Post Options

Feb 16 2006, 02:10 AM (Post #8)
(Absolute Knowledge)
* *
Posts: 179
Cash: 24,781 / 0
Group: Citizen
Joined: 2/12/06 04:51 AM
*looks at the time he posted that java post*

Ah, it was right after I got home from school. I was tired probably <...< I meant JavaScript.
Post Options

Feb 16 2006, 02:15 AM (Post #9)
General
* * * * * * *
Posts: 4,937
Cash: 29,817,448 / 68,857,771
Group: Representative
Joined: 11/26/02 02:31 AM
Alright, I can help, though I'm not the best at teaching.. more of a good reference.

How much of Javascript do you know, exactly?
Post Options

Feb 16 2006, 02:28 AM (Post #10)
(Absolute Knowledge)
* *
Posts: 179
Cash: 24,781 / 0
Group: Citizen
Joined: 2/12/06 04:51 AM
<Script language ="JavaScript">
<----hide from browsers

----->
</script>


bigeyes.gif That's about it, if that's right lol...
Post Options

Feb 21 2006, 10:05 PM (Post #11)
Not Odd anymore
* * * * * * * * * *
Posts: 45,875
Cash: 1,915,578 / 1,817,041,051
Group: Administrator
Joined: 7/10/02 09:48 PM
and what he said on the tutorial?
Post Options