Tutte risposte che puoi trovare nel forum (la riceca si fa con il bottone in alto a dx).

la sitnassi in JS (DOM) e`:
document.getElementById('mydiv').style.display = 'none';

Invece che cercare lo sniffing del browser (che fallisce non appena esce un nuovo browser), cerca di programmare cross-browser (verifica la sintassi con un manuale).