Jump to content

Javascript style hacks


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 post
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 post
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 post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...