SMF For Free Support Forum
Signup For Free Forum
September 05, 2008, 04:26:04 pm *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Welcome to SMF For Free. The best free SMF Host
 
   Home   Help Search Arcade Gallery Login Register  

Pages: [1]
  Print  
Author Topic: [Tutorial]Variables  (Read 276 times)
0 Members and 1 Guest are viewing this topic.
Agent Moose
Moderator
*****
Offline Offline

Posts: 625


Do not PM me for Code Support or Request


View Profile WWW
« on: June 14, 2007, 09:46:54 pm »

Forum Url: http://smcodes.smfforfree3.com
What is a Variable?
A variable is a "container" for information you want to store. A variable's value can change during the script. You can refer to a variable by name to see its value or to change its value.

Ok, How do I use them?
There are two ways you can start out a variable.  You can use this;
Code:
<script>
var name = value
</script>

Or, you can use a shorter way:
Code:
<script>
name = value
</script>

It doesn't matter which one you use.

What exactly would I use them for?
As you read above, variables are "containers".  They can hold HTML, or text, or even other scripts just as Jquery and Javascript codes.

Here is an example of useing a variable for text...
Code:
<script>
name = "Text is being Used"
</script>

Now, that will not show anywhere because it doesn't have anything to make it show.  To make it you would use this...
Code:
<script>
name = "Text is being Used"
document.write(name)
</script>
As you can see, the document.write() is holding the variable name, "name".  So, the text that would show would be "Text is being Used" since that is the text in the variable.

You may use HTML in the variables.  Just one thing you need to remember, you can't use double quotes, you must use Single Quotes.

That is basicly it for the variable tutorial.  That is the best I can do it, I hope you get it and like the tutorial!
Logged

Eternal Flame Coming Soon

SMC Code Index - The best Code Index for all your Needs!  Includes a bunch of codes not on Support.
deathwilldie
Style Designer
****
Offline Offline

Posts: 569

Give me an idea for a Stylesheet


View Profile WWW
« Reply #1 on: June 15, 2007, 01:32:53 am »

Nice tutorial Moose.  You need to make more sooner though.
Logged


Eternal Flame Coming soon.


Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.5 | SMF © 2006-2008, Simple Machines LLC
ServerBeach Coupon
Page created in 0.196 seconds with 17 queries.