473,503 Members | 2,313 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Convert simple CSS to JavaScript

82 New Member
Hello.
I have following CSS code:
[HTML]#container .my_href {
text-decoration: none;
}[/HTML]
How to convert it in JS?
Nov 14 '07 #1
3 1549
Dasty
101 Recognized Expert New Member
http://codepunk.hardwar.org.uk/css2js.htm

so, obj.textDecoration in your case.
Nov 14 '07 #2
satas
82 New Member
obj.textDecoration in your case.
Yes, I know this property.
But, for example, what do i need to do with following construction?
[HTML]#container ul li a {
text-decoration: none;
}
[/HTML]
Nov 14 '07 #3
acoder
16,027 Recognized Expert Moderator MVP
But, for example, what do i need to do with following construction?
[HTML]#container ul li a {
text-decoration: none;
}
[/HTML]
For that, you get the container using:
Expand|Select|Wrap|Line Numbers
  1. var container = document.getElementById("container");
then get the UL, LI and A elements using getElementsByTagName() :
Expand|Select|Wrap|Line Numbers
  1. var uls = container.getElementsByTagName("ul");
  2. for (i = 0; i < uls.length; i++) {
  3.   var lis = uls[i].getElementsByTagName("li");
  4.   for (j = 0; j < lis.length; j++) {
  5.     var links = lis[j].getElementsByTagName("a");
  6.     ...
  7.   }
  8. }
Nov 14 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

5
5594
by: Robin Johnson | last post by:
Hi, I've written an engine in Javascript for running text adventure games on a web page: http://www.robinjohnson.f9.co.uk/adventure/hamlet.html (That's the only game I've written with it so...
4
4293
by: CSharpener | last post by:
This should be *so* easy! How do I convert a Byte or int to a binary string representation in C# In JavaScript, it goes like this for an int: javascript:(123).toString(2 or...
4
3347
by: CSharpener | last post by:
This should be *so* easy! How do I convert a Byte or int to a binary string representation in C# In JavaScript, it goes like this for an int: javascript:(123).toString(2 or...
4
49230
by: CSharpener | last post by:
This should be *so* easy! How do I convert a Byte or int to a binary string representation in C# In JavaScript, it goes like this for an int: javascript:(123).toString(2 or...
19
3564
by: VK | last post by:
http://groups.google.com/group/comp.lang.javascript/browse_frm/thread/ b495b4898808fde0> is more than one month old - this may pose problem for posting over some news servers. This is why I'm...
0
7194
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7070
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7267
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6976
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
4666
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3148
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1495
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
729
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
372
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.