<!DOCTYPE html>
<html>
<head>
	<title>动态网页</title>
	<script type="text/javascript">
		function changeText() {
			var text = document.getElementById("text");
			text.innerHTML = "Hello, World!";
		}
<pre><code>	function changeColor() {
		var text = document.getElementById(&quot;text&quot;);
		text.style.color = &quot;red&quot;;
	}
&lt;/script&gt;
</code></pre>
</head>
<body>
	<h1 id="text">这是一个动态网页</h1>
	<button onclick="changeText()">改变文本</button>
	<button onclick="changeColor()">改变文本颜色</button>
</body>
</html>
帮我生成一个基于HTML和js的动态网页

原文地址: https://www.cveoy.top/t/topic/EM0 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录