<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
div{
width: 100px;
height: 100px;
background: red;
-webkit-transition: 5s;
-moz-transition: 5s ;
-ms-transition: 5s ;
-o-transition: 5s ;
transition: 5s ;
}
</style>
</head>
<body>
<input type="text" id = "num">
<input type="button" value = "测试" id="btn">
<div id = "box"></div>
<script>
var btn = document.getElementById("btn");
var box = document.getElementById("box");
var num = document.getElementById("num");
btn.onclick = function(){
var value = num.value;
if(value == "123"){
box.style.backgroundColor = "pink";
box.style.width = "600px";
box.style.height = "600px";
}
}
</script>
</body>
</html>