Jump to content

simple javascript checking for border styling and then removing it>


galvin

Recommended Posts

So simple I'm sure.  I need help with the syntax for the stuff below in between the asterisks...

 

if (*any element on the page has a border style* = '1px solid red') { //see if any elements have a border
*set the style of those elements border*  = 'none';  //take the border styling away
} 
document.getElementById('box'+val).style.border = '1px solid red';  //set a specific element to  have border styling again

 

The 3rd line of code works fine, but I need to get the IF statement working.  I tried using "document.style.border" but that didn;t work  :-\

 

Can anybody help?

An easier way to ask this might be...

 

Using Javascript, how do I search the page for ANY elements with a certain CSS style (for example "color: blue") and change them to red?  There could be one, there could be many.

 

I think my basic code structure above is correct, but need help with exact syntax.

 

 

 

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.