<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<div id="tip">
</div>
<input id="in" type="text" value="123">
<button onclick="add()">点我一下</button>
</body>
</html>
<script>
function add(){
//获取指定id的元素
tip = document.getElementById("tip")
int2 = document.getElementById("in")
// tip.innerText = "hello world"+12.277.toFixed(2)
tip.innerText = int2.value
}
</script>
css html 修改div的内容
于 2022-02-08 22:33:04 首次发布