首页javascriptstyleJavascript Style - 如何添加动态样式

Javascript Style - 如何添加动态样式

我们想知道如何添加动态样式。

<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
.blue {
  background-color: blue;
}
</style>
<script type='text/javascript'>
window.addEvent('load', function() {
    document.body.className = 'blue';
});
</script>
</head>
<body>
</body>
</html>