Unable to get color value
ԾvԾ人人余耳总
ԾvԾ人人余耳总 2019-04-03 09:48:22
0
3
1278

<form> 

<div>

 <input type="color" name="color" id="color"> <input type="button" name="btn" id="btn" value="获取颜色"> 

<input type="text" name="color_value" id="color_value"> </div></form> 

<script> document.getElementById('btn').onclick=function(){ document.getElementByid('color_value').value=document.getElementByid('color').value; } </script>

 我的代码哪里有问题?

ԾvԾ人人余耳总
ԾvԾ人人余耳总

reply all(1)
团子

What you are getting is the value of the DOM, and does not involve color. . .

  • reply This code is also used in the video tutorial. What should color.value be changed to?
    ԾvԾ人人余耳总 author 2019-04-03 21:54:23
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template