Estuches de estilo sin línea
#div1 {ancho: 200px; Altura: 200px; Antecedentes: rojo;}Es decir, obtiene estilos sin línea
var odiv = document.getElementById ('div1'); odiv.currentstyle.width; Chrome/ff obtiene estilo no línea var odiv = document.getElementById ('div1'); odiv.getComputedStyle (Odiv, False) .Width;Mi compatibilidad escribiendo
var odiv = document.getElementById ('div1'); var elewidth = odiv.currentstyle && odiv.currentstyle.width || GetComputedStyle (Odiv, False) .Width;Mi extensión
función getStyle (obj, nombre) {return obj.CurrentStyle? obj.CurrentStyle [nombre]: getComputedStyle (obj, falso) [nombre];}== nota == Lo anterior solo puede obtener estilos no línea, y no puede establecer valores para estilos no de la habitación.
Lo anterior es la descripción completa del resumen de compatibilidad de JavaScript introducido por el editor para obtener estilos sin línea. Espero que sea útil para todos. Si tiene alguna pregunta, déjame un mensaje. ¡El editor responderá a todos a tiempo!