html5颜色选择器代码
时间: 2023-11-12 14:20:57 浏览: 209
<!DOCTYPE html>
<html>
<head>
<title>HTML5颜色选择器</title>
</head>
<body>
<h1>HTML5颜色选择器</h1>
<p>请选择一个颜色:</p>
<input type="color" id="colorPicker" value="#ff0000">
<p>您选择的颜色是:<span id="colorValue">#ff0000</span></p>
<script>
var colorPicker = document.getElementById("colorPicker");
var colorValue = document.getElementById("colorValue");
colorPicker.addEventListener("input", function() {
colorValue.innerText = colorPicker.value;
});
</script>
</body>
</html>
阅读全文