Page 1 of 2

Parlez-vous "Javascript"

PostPosted: Thu May 31, 2007 2:43 pm
by omoi
Hello out there, would-be/already-are web coders :) This is going to be the beginning of what could a wonderful tutorial on javascript. I am going to try to start out light. Here goes.

So you saw someone using a few effects on their page and you thought it was cool, huh? Well, that might have been javascript (nowadays, that might be AJAX) that you saw. So now you know, but how do you make those pretty, shiny effects work for you?

Maybe I can tell you a little.

As far as the background goes, javascript is an object oriented language for web coding that revolves around the Document Object Model (commonly referred to as the DOM). For a better explanation than I could explain, check out w3schools' intro to Javascript.

Heck, you may even want to read their whole tutorial, but I am going to write this one anyway.

When you want to write javascript, you can write it either internally or externally. Since most Javascript that is seen for the average website is internal, I am going to approach things from that angle. Internal javascript can be in the <head> tag or the <body> tag. Most of the time it lives in the head tag if you have parts of your javascript that need to run before the page loads. However, you can also put it in the <body> tag if you don't care whether the javascript runs before the page load or after.

Where does Javascript live? Well, it's mansion can be found within the rolling hills of the <script> tag like this:

Code: Select all
.
.
.
<head>
<script ...>
your javascript stuff
</script>
</head>
.
.
.


Since Javascript isn't the only kind of script there is, you have to tell your script tag "I'm writing Javascript!" In order to do that, you can write like this:

Code: Select all
.
.
.
<script language="text/javascript">
.
.
.


It will run just fine. Now, if you are wanting to validate your page using w3c or a similar site, you may run into a few snafu's if you use the format I just gave you because XHTML Strict 1.x standard web pages see that <script> tag as malformed. Because of this, if you are using the XHTML Strict standard, then please use the following:

Code: Select all
.
.
.
<script type="javascript">
.
.
.


Alternately, I think you could use "type='text/javascript'" and still be okay.

Now while I would to tell you all about the wonderful things you can do with this now, it will be better if I make you wait until the next installation where I talk to you about objects and methods, so until next time.

Re: Parlez-vous "Javascript"

PostPosted: Thu May 31, 2007 3:40 pm
by super3boy
Great I look forward to this. I have to learn some javascript and ajax to continute my web goals. I also have to figure out how to work an api in a web scripting language.

Re: Parlez-vous "Javascript"

PostPosted: Fri Jun 15, 2007 5:27 am
by Brent
super3boy wrote:Great I look forward to this. I have to learn some javascript and ajax to continute my web goals. I also have to figure out how to work an api in a web scripting language.

For the API goal, learn ASP.NET.

Re: Parlez-vous "Javascript"

PostPosted: Fri Jun 15, 2007 1:49 pm
by super3boy
I will take your advice. What program do I need to code that in? One of the express editions? I will also have to find a host. Could you host my scripts? (My package does not support asp)

Re: Parlez-vous "Javascript"

PostPosted: Fri Jun 15, 2007 2:29 pm
by Brent
super3boy wrote:I will take your advice. What program do I need to code that in? One of the express editions? I will also have to find a host. Could you host my scripts? (My package does not support asp)
Neither does mine. I can host your scripts on my desktop. It just can't be port 80. Seeing how my ISP blocks port 80. :cuss:

Re: Parlez-vous "Javascript"

PostPosted: Fri Jun 15, 2007 2:32 pm
by super3boy
:cuss: ISPs.

localhost?

PostPosted: Fri Jun 15, 2007 7:05 pm
by omoi
you could also host them on your own machine, super3.

Re: Parlez-vous "Javascript"

PostPosted: Fri Jun 15, 2007 9:32 pm
by super3boy
But my :cuss: does not let me do outgoings stuff.

Re: Parlez-vous "Javascript"

PostPosted: Thu Jul 05, 2007 5:17 pm
by Roswell
@omoi: Actually, "text/javascript" is correct, "javascript" is incorrect.
@cg, super3: You do not have to use ASP for an API. Many API's (Flickr's, for instance), as well as a few others that I know of are coded using PHP.

Re: Parlez-vous "Javascript"

PostPosted: Thu Jul 05, 2007 5:47 pm
by omoi
Roswell wrote:@omoi: Actually, "text/javascript" is correct, "javascript" is incorrect.
@cg, super3: You do not have to use ASP for an API. Many API's (Flickr's, for instance), as well as a few others that I know of are coded using PHP.


I figured that out a little later. I really should edit that. Thanks for the reminder.