Jump to content

Javascript style hacks


vchris

Recommended Posts

Is there a way to have the underscore of mozilla hacks work in javascript.Example:document.getElementById('extraRow_' + i).style._display = 'table-row';This code doesn't seem to work. Is there any way to do this? It needs to be dynamic that's why I need JS. I change the display to none or table-row when it's FF when a certain option is selected in the form.

Link to comment
Share on other sites

I don't usually use hacks, actually I never do. But this situation seems to require them or some other kind of way to act differently depending on the browser.The problem with conditional comments are that someone will need to update these statements upon new/update browser release.The problem is the display property in a table is pretty complex with IE and FF. FF works perfect with table and table-row but IE works well with anything but that.

Link to comment
Share on other sites

If you aren't using inline styles for these elements, you could try something like this:

document.getElementById('extraRow_' + i).setAttribute("style", "_display: table-row;");

EDIT: Of course, this doesn't work in IE :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...