
Is there an equivalent in Firefox for the javaScript element.style['css_to_change']?
I am trying to make an website compatible to Firefox, but the element.style['CSS_to_change'] doesn't seem to work (example: document.getElementById('element_ID').style['-moz-transform'] = 'rotate(90deg)'; should rotate the element which id is 'element_ID' to 90 degrees). This works in Google Chrome and I'm wondering if there is anything equivalent with it in Firefox... I am sorry if I put this question in the wrong place and thank you in advance! Please let me know when you have an answer.
Chosen solution
Try this:
document.getElementById('element_ID').style.setProperty('-moz-transform','rotate(90deg)','');
javascript:void( document.getElementById('question').getElementsByTagName('IMG')[0].style.setProperty('-moz-transform','rotate(180deg)',''));Read this answer in context 👍 3
All Replies (2)
Chosen Solution
Try this:
document.getElementById('element_ID').style.setProperty('-moz-transform','rotate(90deg)','');
javascript:void( document.getElementById('question').getElementsByTagName('IMG')[0].style.setProperty('-moz-transform','rotate(180deg)',''));
Modified
Thank you. Actually I found later that element.style['...'] is working , but I should have replaced -moz-transform (which I found on a website) with MozTransform (from another website)... I hate the browser differences. Thank you a lot. Now I know two ways to set some CSS :)