vchris Posted December 27, 2006 Share Posted December 27, 2006 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 More sharing options...
aspnetguy Posted December 27, 2006 Share Posted December 27, 2006 I doubt it...one more reason to enforce the recommendation that you don't use hacks, but conditional comments instead. Link to comment Share on other sites More sharing options...
vchris Posted December 27, 2006 Author Share Posted December 27, 2006 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 More sharing options...
aspnetguy Posted December 27, 2006 Share Posted December 27, 2006 you could try if(document.all) //IE document.getElementById('extraRow_' + i).style.display = 'something for ie';else document.getElementById('extraRow_' + i).style.display = 'table-row'; Link to comment Share on other sites More sharing options...
jesh Posted December 27, 2006 Share Posted December 27, 2006 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 More sharing options...
vchris Posted December 27, 2006 Author Share Posted December 27, 2006 aspnetguy: Works nicely! Thanks. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now