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’
}

Advertisements

One response to this post.

  1. Nice put up! I am just beginning out in neighborhood management/advertising media and attempting to learn to do it nicely – sources like this text are incredibly helpful. As our company relies in the US, it?s all a bit new to us. The instance above is one thing that I worry about as well, the way show your individual real enthusiasm and share the fact your product is beneficial in that case.

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: