Home > Web Front-end > JS Tutorial > body text

js setattribute sets css styles in batches_javascript skills

WBOY
Release: 2016-05-16 18:41:09
Original
1859 people have browsed it

Firefox, etc. can use
var dom=document.getElementById("name");
dom.setAttribute("style","width:10px;height:10px;border:solid 1px red;");

In IE, style.cssText must be used

var dom=document.getElementById("name");
dom1.style.cssText = "width:10px;height:10px;border: solid 1px red;";

To add, style.cssText is now similar to innerHTML and has become a de facto standard for web development. So the test shows that the firefox browser also supports this method.

Related labels:
js
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template