[HTML5] 颜色选择器的操作[input type='color'....]

一、点击事件和获取颜色值

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body style=" background: rgb(238, 255, 255);">
<input type="color" id="onchange">
</body>
<script type="text/javascript">
document.getElementById('onchange').onchange = function(){
document.getElementById('onchange').click();
document.body.style.background = this.value;
};
</script>
</html>
上一篇:CF1043


下一篇:PAT-乙级-1053. 住房空置率 (20)