Hello and welcome to the Webmasters Forums!. This is the best place to get webmasters resources for free. Get $2 for free today, read more - Make your payment today. Download premium and professional templates for free. Get free web hosting without ads, read more. You can get lot more by simply join with this forum. To gain full access to the forums you must sign up for a free account.


Post Reply  Post Thread 

Learn JavaScript Basics

Post Bank
Posting Manager
******

Posts: 995
Group: Forum Team
Joined: Sep 2006
Status: Online
Make money from now. You can make money just for posting on this forum. Every discussions on this community gives you more money. $2 minimum payout. So get your payment today, SignIn with this forum.

Signin to Remove this Post

ivenms
Administrator
*******


Posts: 2,179
Group: Administrators
Joined: Sep 2006
Status: Offline
Reputation: 14
Points: 4389 (Donate)
Post: #1

Smile Learn JavaScript Basics


To get started with JavaScript, you will want to be able to see the tag that will set a script apart from the HTML. The tags used to begin and end a script are the <SCRIPT> and </SCRIPT> tags. The opening tag should appear like this:

<SCRIPT language="JavaScript">

The language="JavaScript" command is there so the browser can tell the code that follows is in JavaScript and not another scripting language, such as VBScript. The javascript code will follow this tag, and end with the </SCRIPT> tag:

<SCRIPT language="JavaScript">

........JavaScript Code...........

</SCRIPT>

You can have as many <SCRIPT> tags as you need throughout the body of your HTML document, just as though it were a normal tag. Just remember to close each tag before you go on! Also, if you are going to use JavaScript functions (we will get to these later on) , you will need to place your functions inside the <HEAD> </HEAD> tags of your document. This way, your functions are loaded before the page begins to display, and you won't see all kinds of JavaScript errors. Here is an example:

<HEAD>
<TITLE>My World</TITLE>

<SCRIPT language="JavaScript">

function cool()
{
JavaScript Stuff...
}

</SCRIPT>

</HEAD>

Now, there is still one last thing you should see before we begin writing scripts. Since there are older browsers being used out there, they do not recognize the <SCRIPT> tag. Rather than performing your javascript, they will display the text of your script as though you meant for it to be a few lines of text on the screen. To get around this problem, you have to trick the browser into ignoring the text within the <SCRIPT> tag. This is done by using an HTML comment. The older browsers will ignore the text inside the comments, but a JavaScript capable browser will go ahead and perform your script. Here is how to do it:

<SCRIPT language="JavaScript">

<!-- This opens the HTML comments that will hide the script from old browsers

......Javascript Statements.......

//--> This closes the comment section and the browser will read on normally

</SCRIPT>


Read: General Rules & Policies before posting.
Make Money By Posting | Earning and Exchanging Points | Add Your Links
15-09-2006 02:54 AM
Find all posts by this user Quote this message in a reply
ratedguy
Newbie


Posts: 9
Group: Registered
Joined: Jul 2008
Status: Offline
Reputation: 0
Points: 38 (Donate)
Post: #2

RE: Learn JavaScript Basics


GUD Attempt .. bt wht about this >
function cool()
{
JavaScript Stuff...
}



^^^ wht does it specify ?

14-07-2008 06:20 PM
Find all posts by this user Quote this message in a reply
Post Reply  Post Thread 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
Toungue Image Rollover Script Javascript ratedguy 0 48 14-07-2008 06:15 PM
Last Post: ratedguy
  I'm New to Javascript MaGiC DaN90 3 898 16-05-2008 04:37 PM
Last Post: ivenms
  Using iframes with javascript godkillah 0 1,387 26-01-2008 06:19 AM
Last Post: godkillah
  The JavaScript that Randomly Select the Quotes ivenms 9 601 29-09-2007 01:46 AM
Last Post: godkillah
Rolleyes JavaScript Redirection ivenms 0 620 15-09-2006 03:21 AM
Last Post: ivenms
Big Grin JavaScript Browser Detection ivenms 0 810 15-09-2006 03:20 AM
Last Post: ivenms
Smile JavaScript Alerts ivenms 0 631 15-09-2006 03:04 AM
Last Post: ivenms

View a Printable Version
Send this Thread to a Friend
Subscribe to this Thread | Add Thread to Favorites
Rate This Thread:

Forum Jump:

Sign In to Remove Ads

Download 1000's of web templates. Unlimited access!
World's Best Web Hosting
Website of the Month

Create-a-Page for Free
SOTM June 2008


Accepting Submissions
for July 2008
Resources

Recommended Sites:



Visit our Sponsors!

Current time: 30-08-2008, 07:56 AM


Copyright © 2002-2008 MyBB Group
Powered By MyBB