<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>html dom </title>
</head>
<body>
<div id="div1">div1</div>
<script>
var div= document.getElementById("div1");
var div_name = div.innerHTML;
alert(div_name);//获取标签体内容
//div.innerHTML = "<input type='text'>";//替换标签体内容
div.innerHTML += "<input type='text'>";//追加标签体内容
</script>
</body>
</html>
innerHtml对标签体内容的获取,替换 ,与追加
最新推荐文章于 2024-04-21 15:25:48 发布