galvin Posted February 9, 2011 Share Posted February 9, 2011 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? Quote Link to comment https://forums.phpfreaks.com/topic/227112-simple-javascript-checking-for-border-styling-and-then-removing-it/ Share on other sites More sharing options...
galvin Posted February 9, 2011 Author Share Posted February 9, 2011 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. Quote Link to comment https://forums.phpfreaks.com/topic/227112-simple-javascript-checking-for-border-styling-and-then-removing-it/#findComment-1172011 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.