用JavaScript实现元素自动旋转功能
JavaScript模块
<script>
function rotate() {
setInterval(fun, 100)
}
var deg = 0;
function fun() {
var obj = document.getElementById("login");
deg += 1;
var d = deg + "deg";
obj.style.transform = "rotate(" + d + ")";
}
</script>
html模块
<!--调用函数-->
<body onload="rotate();">
<div class="re">
<!--id为login-->
<div class="fa" id="login">
<div class="faa">
<form>
<div>账户:<input type="text"></div>
<div>密码:<input type="password"></div>
<div><input type="submit"></div>
</form>
</div>
</div>
</div>
</body>