Webmaster Malaysia Forum  


Go Back   Webmaster Malaysia Forum > Website Design & Development > Website Programming

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
Where is the difference between ID and CLASS?
Old
  (#1 (permalink))
Novice Webmaster
kaisology is on a distinguished road
 
Status: Offline
Posts: 81
Join Date: Jul 2007
Location: Malaysia
Rep Power: 0
Where is the difference between ID and CLASS? - 21-03-2008, 01:19 PM

hm I remember there is a thread about ID n CLASS here somehow it is lost (n i too lazy to dig it out), so i make a new thread here ask the same question again

where is the difference between id n class? when to use id when to use class? i experimentally used them to hold several kind of properties n both of them works pretty well, cant see the different??

Last edited by kaisology : 21-03-2008 at 01:21 PM.
   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old
  (#2 (permalink))
Lost Webmaster
yipguseng will become famous soon enough yipguseng will become famous soon enough
 
yipguseng's Avatar
 
Status: Offline
Posts: 829
Join Date: Jan 2007
Location: Petaling Jaya
Rep Power: 36
21-03-2008, 06:52 PM

a very simple explanation for understanding:
---
ID is a unique and therefore can only exist only 1 time in a single html file. all the attribute that's being declare in css for ID can only be use for a single element.

CLASS is the opposite of ID. All the attribute that's being declare in css for CLASS can be use multiple times on any html elements.
---

that's the definition, both actually does work well and see no difference as u said but if u check with the web standard checker, those html which has 2 same ID in a single html will return error. That's for web standard

and is better that u differentiate ID and CLASS properly as believe me, is very useful when u do some CSS modification in the future. "changing an ID attribute wont change anything else but changing CLASS attribute will affect others"

hope my explanation is clear
  Send a message via MSN to yipguseng  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old
  (#3 (permalink))
Novice Webmaster
kaisology is on a distinguished road
 
Status: Offline
Posts: 81
Join Date: Jul 2007
Location: Malaysia
Rep Power: 0
21-03-2008, 08:41 PM

thanks yes clear enough!!!
   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old
  (#4 (permalink))
Super Moderator
mysticmind will become famous soon enough mysticmind will become famous soon enough
 
mysticmind's Avatar
 
Status: Offline
Posts: 2,485
Join Date: Jun 2001
Location: Mystic Kingdoms
Rep Power: 136
21-03-2008, 09:41 PM

id vs class play big roll in ajax
  Send a message via Yahoo to mysticmind  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old
  (#5 (permalink))
Inspired Webmaster
hashie is on a distinguished road
 
hashie's Avatar
 
Status: Offline
Posts: 165
Join Date: Jun 2007
Location: Kuala Lumpur
Rep Power: 16
22-03-2008, 01:55 AM

haha simply description,

u lost ur id card, it doesn matter, u still can go for class..but there's no class, how u study? lol..jk..

just id represent for 1 thing, like ur id card never able to share with other, but class, just like u're planning to attend a programming class, there's thousand sections of classes where teaching programming (for you to choose) and all are also known as programming class. haha..hope u understand what am i explaining.

lol..


Hash here..
   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old
  (#6 (permalink))
Novice Webmaster
kaisology is on a distinguished road
 
Status: Offline
Posts: 81
Join Date: Jul 2007
Location: Malaysia
Rep Power: 0
22-03-2008, 02:35 AM

Quote:
Originally Posted by mysticmind View Post
id vs class play big roll in ajax
what role they r playing in ajax?
haha here i comes another question: difference between 'ajax' and 'javascript'?
   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old
  (#7 (permalink))
Novice Webmaster
Monie is on a distinguished road
 
Status: Offline
Posts: 46
Join Date: Mar 2008
Location: Sabah
Rep Power: 0
22-03-2008, 05:41 PM

Quote:
Originally Posted by kaisology View Post
hm I remember there is a thread about ID n CLASS here somehow it is lost (n i too lazy to dig it out), so i make a new thread here ask the same question again

where is the difference between id n class? when to use id when to use class? i experimentally used them to hold several kind of properties n both of them works pretty well, cant see the different??
I was wondering what ID and CLASS are you talking about?
Yipguseng has explain it well

You can learn about AJAX in OpenDNS
   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old
  (#8 (permalink))
Novice Webmaster
Monie is on a distinguished road
 
Status: Offline
Posts: 46
Join Date: Mar 2008
Location: Sabah
Rep Power: 0
22-03-2008, 05:45 PM

For some reason, I can't even edit my own post!!!

Anyway,
AJAX doesn't enhance Javascript. It relies on it. Javascript is a client side technology. It is purely run on the browser. AJAX can be thought of as interface between the technologies.
AJAX just uses javascript to communicate with the server in the form of XML. That's all. There's no magical difference between javascript and AJAX, AJAX is an implementation of javascript.

EDIT: the correct link is this: W3schools

Last edited by Monie : 22-03-2008 at 05:48 PM.
   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old
  (#9 (permalink))
Novice Webmaster
kaisology is on a distinguished road
 
Status: Offline
Posts: 81
Join Date: Jul 2007
Location: Malaysia
Rep Power: 0
25-03-2008, 03:13 AM

Quote:
Originally Posted by Monie View Post
For some reason, I can't even edit my own post!!!

Anyway,
AJAX doesn't enhance Javascript. It relies on it. Javascript is a client side technology. It is purely run on the browser. AJAX can be thought of as interface between the technologies.
AJAX just uses javascript to communicate with the server in the form of XML. That's all. There's no magical difference between javascript and AJAX, AJAX is an implementation of javascript.

EDIT: the correct link is this: W3schools
Still dont get what you meant...but thank you for the explaination at least you give me some idea d
   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old
  (#10 (permalink))
Novice Webmaster
BasicCX is on a distinguished road
 
BasicCX's Avatar
 
Status: Offline
Posts: 47
Join Date: Apr 2004
Location: Cheras, Selangor.
Rep Power: 0
26-03-2008, 11:24 PM

Javascript and AJAX is no different at all. That why i wonder after quite some time leaving for a short time World Wide Web and suddenly come back heard about AJAX/WEB 2.0 etc. Look at the coding and realised that it is the same Javascript with wide application use only. Long time ago has build this kind of code. Just never give a name for it..haha


Check out: http://www.xpodonline.com
Hosting & Domain: http://www.cubiex.com
  Send a message via Yahoo to BasicCX  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old
  (#11 (permalink))
Novice Webmaster
shidi is on a distinguished road
 
shidi's Avatar
 
Status: Offline
Posts: 18
Join Date: Apr 2004
Location: Ampang
Rep Power: 0
27-03-2008, 07:36 AM

What being said from the first reply is true. Id should be unique in per page, i.e can only be use once. Where as class can be use repetitively.

Some might not see the importance of this, as they tend to use id instead of class again and again.

As for me, I followed this rule strictly since I'm using jQuery, a javascript framework for my works. On events such as, click, submit, etc, jQuery heavily depending on id and classes.

I believe for those who work a lot with Javascript, to say the least, would see the importance in differentiating id and class.


""If you must break the law, do it to seize power: in all other cases observe it." - Julius Caesar
  Send a message via Yahoo to shidi  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On