Welcome Guest [Log In] [Register]
Search Members Calendar | Rules ZB Code Index IF Code Index
ZBCode
  • Navigation
  • ZBCode
  • Coding Support
  • Code University
  • First steps of Javascript
Hey, welcome to ZBCode, the premier coding forum for ZB. Here you fill find some of the best Invisionfree and Zetaboards Codes on the network! Unfortunately, you're sorta hovering around in guest mode at the moment; why not join in on the fun? Register an account and you can start accessing the wealth of resources we have available here. Enjoy your stay at ZBCode, and remember to tell all your friends about us; the more members, the more codes available. ;)

Interested in joining? Click here.


If you are already a member of ZBCode, feel free to login right here:

Username:   Password:
Locked Topic
  • Pages:
  • 1
  • 2
First steps of Javascript
Tweet Topic Started: Feb 5 2009, 06:14 AM (530 Views)
Leonardo Feb 5 2009, 06:14 AM Post #1
Member Avatar
Peter Griffin

Posts:
52
Group:
Member
Member
#167
Joined:
Jul 21, 2008
Coding language
HTML/CSS
Hello

I've been meaning to learn Javascript for a while now but never really got into because I would always get stuck and drop it. I have knowledge of HTML and CSS, which I believe would come in handy with JS.

So what should I learn first to build my knowledge of JS? Shall we take baby steps? :rolleye:

Thanks

Posted Image


Offline Profile Goto Top
 
HolySavior Feb 5 2009, 12:14 PM Post #2
Member Avatar
Modifying The World Around You

Posts:
2,488
Group:
Distinguished Coder
Member
#7
Joined:
Jul 2, 2008
Coding language
Everything
http://zbcode.com/topic/1069406/1/

there is a nice post where to begin
Offline Profile Goto Top
 
Vitality Feb 5 2009, 09:36 PM Post #3
Member Avatar
Tabula Rasa

Posts:
784
Group:
Former Staff
Member
#320
Joined:
Jul 26, 2008
I would also recommend HolySvavior's blog.
Offline Profile Goto Top
 
Kotton Feb 6 2009, 02:39 AM Post #4

Posts:
60
Group:
Banned
Member
#1,668
Joined:
Dec 1, 2008
HolySavior
Feb 5 2009, 12:14 PM
http://zbcode.com/topic/1069406/1/

there is a nice post where to begin
I'm thinkn, maybe you should rename that topic and pin it.. just browsing, there's no signs that there's a bad ass tutorial contained within
Offline Profile Goto Top
 
Leonardo Feb 6 2009, 07:00 AM Post #5
Member Avatar
Peter Griffin

Posts:
52
Group:
Member
Member
#167
Joined:
Jul 21, 2008
Coding language
HTML/CSS
Thanks Dan and Vitality.
I've got a question, you know how you said we use document.getElementByID(), is there one for classes instead of IDs or can you place classes into that as well?

Posted Image


Offline Profile Goto Top
 
HolySavior Feb 6 2009, 02:09 PM Post #6
Member Avatar
Modifying The World Around You

Posts:
2,488
Group:
Distinguished Coder
Member
#7
Joined:
Jul 2, 2008
Coding language
Everything
in Jsavascript there none like closest thing is

document.getElementsByClassName ==" something" normally thats used in an IF statment mainly because class names are used differently than IDs
Offline Profile Goto Top
 
Leonardo Feb 6 2009, 05:47 PM Post #7
Member Avatar
Peter Griffin

Posts:
52
Group:
Member
Member
#167
Joined:
Jul 21, 2008
Coding language
HTML/CSS
I see but why do you have two equal signs? I sometimes see 3 as well.

Posted Image


Offline Profile Goto Top
 
Vitality Feb 7 2009, 08:45 AM Post #8
Member Avatar
Tabula Rasa

Posts:
784
Group:
Former Staff
Member
#320
Joined:
Jul 26, 2008
Well having two equal signs will say "equal to" and having three will say "exactly equal to". Another way of matching something is using the .match() method. It's actually very easy to use.
Code:
 
<script type="text/javascript">
if(location.href.match("/topic/1188295")){
//execute the code
}
</script>

What that is saying is if the location of the address (the url) matches what you've put in the .match() parenthesis, then it will execute your code. You would not include the entire url so this could work for any url containing your match. You can use this with matching text as well, and so on.
Edited by Vitality, Feb 7 2009, 08:46 AM.
Offline Profile Goto Top
 
Everafter May 19 2009, 04:11 AM Post #9
Member Avatar


Posts:
101
Group:
Member
Member
#3,012
Joined:
May 18, 2009
Im finding this a little frustrating. I look at prebuilt code and then go back and say okay I get this and understand that, then get confused again as I start to play with it on my own. * sighs * I am seriously too new to understand programing. I really should just take a real class slong with my electronics classes

I should amend this a little bit. Its not really the coding that is confusing, its the extra symbols and remembering what does what and figuring out, what goes with what to do what I want.
Edited by Everafter, May 19 2009, 04:20 AM.
Offline Profile Goto Top
 
Reid May 19 2009, 07:25 AM Post #10
Member Avatar
What? The land of the free? Whoever told you that was your enemy.

Posts:
1,790
Group:
Distinguished Coder
Member
#148
Joined:
Jul 20, 2008
Yeah, the operators tend to be the most important things in JavaScript, too bad they're also the most vague.

Just remember these, as they are the most important:

++ (raises the current variable by 1) - syntax: z++;
-- (lowers the current variable by 1) - syntax: z--;
&& (logical AND) - syntax: if (a && b) { do something }
|| (logical OR) - syntax: if (a || b) { do something }
< (less than)
> (greater than)
== (equals) - if (a == 'Hello World') { do something }
!= (does not equal) if (a != 'Hello World') { do something}

Those are the most important, I think.

There also is an immensely useful mini-if statement...

(condition?what to do if it's true:what to do if it's false)

So you could have

a ? alert(a) : alert('a does not exist!');

Then if a exists, it will alert what it says. If it doesn't, it will give an alert that says "a does not exist!"

Those are the most important, I think. Of course, there are more operators, but there are some you won't ever use.. I never use the bitwise stuff, for example. :P
The Resource Board
Offline Profile Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
Go to Next Page
« Previous Topic · Code University · Next Topic »
Locked Topic
  • Pages:
  • 1
  • 2

Track Topic · E-mail Topic Time: 7:47 PM Jul 10
Hosted for free by ZetaBoards · Privacy Policy