Go Back   CodingForums.com > :: Client side development > JavaScript programming > DOM and JSON scripting

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-07-2006, 03:59 PM   PM User | #1
TheOne(AKA:T1)
New Coder

 
Join Date: Feb 2006
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
TheOne(AKA:T1) is an unknown quantity at this point
Question Assign Style and class

Ok, I've got this pice of code:
Code:
var ourDiv=document.getElementById('cretor);
  var t=document.createElement('table');
  var tb=document.createElement('tbody');
  t.style.border='8px groove blue';

  var tr=document.createElement('tr');
  var td=document.createElement('td');
Then I append and everything...
My question:
I want to assign a class and a style,
the class named "asdf" and in the style, a "border-top-width of 35px" and a "border-top-style of outset, how do I put them
THX
EDIT:
And if I make a button and whant to assigne it an event, let's say onClick

Last edited by TheOne(AKA:T1); 02-07-2006 at 04:44 PM..
TheOne(AKA:T1) is offline   Reply With Quote
Old 02-07-2006, 05:20 PM   PM User | #2
Kor
Red Devil Mod


 
Kor's Avatar
 
Join Date: Apr 2003
Location: Bucharest, ROMANIA
Posts: 8,478
Thanks: 58
Thanked 379 Times in 375 Posts
Kor has a spectacular aura aboutKor has a spectacular aura about
element.className='myclass';
element.style['attribute']='somevalue'
__________________
KOR
Offshore programming
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Kor is offline   Reply With Quote
Old 02-07-2006, 05:22 PM   PM User | #3
TheOne(AKA:T1)
New Coder

 
Join Date: Feb 2006
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
TheOne(AKA:T1) is an unknown quantity at this point
THX men
EDIT:
Whyyyyyyyyy!!!!!
The class thing worked, but when I tryed this:
t.style['border-top-width']='35px';
it doesn't works!!!!!!
("t" is my element)

Last edited by TheOne(AKA:T1); 02-07-2006 at 05:52 PM..
TheOne(AKA:T1) is offline   Reply With Quote
Old 02-07-2006, 07:11 PM   PM User | #4
liorean
The thread killer


 
Join Date: Feb 2003
Location: Umeå, Sweden
Posts: 5,575
Thanks: 0
Thanked 84 Times in 75 Posts
liorean will become famous soon enoughliorean will become famous soon enough
It doesn't work because the languages allow different characters and sometimes a term used in one language is a reserved word in another.

CSS: "border-top-color" --> JS: "borderTopColor"
HTML: "http-equiv" --> JS: "httpEquiv"
CSS: "float" --> JS: "cssFloat"
HTML: "for" --> JS: "htmlFor"
HTML&CSS: "class" --> JS: "className"
__________________
liorean <[lio@wg]>
Articles: RegEx evolt wsabstract , Named Arguments
Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards
liorean is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:40 AM.


Advertisement
Log in to turn off these ads.