<!DOCTYPE html>
<html>
<head>
	<title>Interactive H1 Title</title>
	<style>
		h1 {
			cursor: pointer;
		}
		h1:hover {
			color: red;
		}
	</style>
</head>
<body>
	<h1 onclick="changeTitle()">This is an interactive H1 title</h1>
<pre><code>&lt;script&gt;
	function changeTitle() {
		let newTitle = prompt(&quot;Enter new title:&quot;);
		document.querySelector(&quot;h1&quot;).textContent = newTitle;
	}
&lt;/script&gt;
</code></pre>
</body>
</html>
请写一个html目的是实现交互式h1标题

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

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