Archive for the ‘Javascript’ Category

Using same class with different elements depending upon the browser in use

Sometimes doing cross browser checks can become really cumbersome and is a heck of a job. IE causes unwanted margins to appear from nowhere, can cause borders to disappear and a myriad of other things as well. Using javascript, here is a simple code that can differentiate the class depending on the browser that we are using.

if(navigator.appName==’Microsoft Internet Explorer’){
document.getElementById(‘vertical1′).className=’css_vertical_text_mineIE’
document.getElementById(‘vertical2′).className=’css_vertical_text_mineIE’
document.getElementById(‘vertical3′).className=’css_vertical_text_mineIE’
document.getElementById(‘vertical4′).className=’css_vertical_text_mineIE’
document.getElementById(‘vertical5′).className=’css_vertical_text_mineIE’
document.getElementById(‘vertical6′).className=’css_vertical_text_mineIE’
}