473,326 Members | 2,114 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Assigning a whole style class with javascript

Hi all,

I just struggling with the follwing problem: I have defined a style
class
..myClass {
color: ....
font-weight: ...
margin:...
...
}

and by using JavaScript I now want to assign the whole class to an HTML
element (a table cell).
The only topics I found were about how to assign a style attribute
(like color:
document.forms['myform'].elements[myElement].style.color = '#FF0000';
)

I have tried a lot but did not get the right syntax to assign my whole
style class "myClass" instead of just the attribute.

Isn't it possible or how is the correct syntax?

Thanks in advance
John

Jul 23 '05 #1
1 5111
document.forms['myform'].elements[myElement].className = 'myClass';

you're welcome ;)

Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Sibylle Koczian | last post by:
I want to try out several applications, all doing the same thing but using different GUI libraries (Tkinter, Qt, wxWindows). Using an example I found in a book I wrote a class containing the GUI...
4
by: terrorix | last post by:
I have create Style class instance and set up properties like this: Style st = new Style(); st.BackColor = Color.Black; st.BorderColor = Color.White; st.BorderStyle = BorderStyle.Solid;...
38
by: looping | last post by:
For Python developers around. >From Python 2.5 doc: The list of base classes in a class definition can now be empty. As an example, this is now legal: class C(): pass nice but why this...
16
by: howachen | last post by:
e.g. <script type="text/javascript" src="js/common.js"></script> but not <script type="text/javascript" src="js/common.js" /> for any reason?
14
by: Keith Clark | last post by:
I want to define a text style class which is active whenever I refer to it. The following does not work in CSS: bluetext { COLOR: blue; FONT-SIZE:16px; } in HTML: ..... <TABLE><TR><TD>...
3
by: J055 | last post by:
Hi I want to add some css rules to the this.Header.StyleSheet property. I need to add margin and some other css properties but the Style class doesn't support them. What is the best way or some...
0
by: _Who | last post by:
I have a .htm the shows in an iframe. I need the .htm to use the style class from the master. The context appears to use it with no problem But I don't know how to propagate it into the .htm
2
by: _Who | last post by:
Hope I'm not posting twice. Posted this a while ago but it does not show in my ng. I have a .htm file that shows in an iframe. I need the .htm to use a style class from the master. The...
6
by: MatthewS | last post by:
I've seen the question raised several times here, but apparently never answered. Since PyInstance_Check returns False for new-style class instances, is there a standard procedure for testing this...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.