/*内容一文省略*/
<body>
<h1>test</h1>
<p id="myPar">This is paragraph</p>
<div id="myDiv">This is Div</div>
<p>
<button type="button" onclick="myFunction()">Click</button>
</p>
<script>
function myFunction(){
// 引き換え内容1
var content1 = "「getElementById」テスト";
// 引き換え内容1
var content2 = "「innerHTML」テスト";
//「getElementById」「innerHTML」テスト
document.getElementById("myPar").innerHTML = content1;
document.getElementById("myDiv").innerHTML = content2;
}
</script>
<p>when you click button up,the content will change</p>
</body>
</html>
More than 1 year has passed since last update.
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme
List of users who liked
00