下面是源码 需要浏览器支持html5
复制代码 代码如下:
<html>
<head>
</head>
<body>
<canvas id=”colorpicker” onmoumove=”showcurrentcolor(event)”>
</canvas>
影响股票价格的因素
<br/>
<div id=”textresult”>
</div>
<script type=”text/javascript”>
if(document.createelement(“canvas”)){
if(document.getelementbyid(“colorpicker”).getcontext){
var can = document.getelementbyid(“colorpicker”);
can.tattribute(“height”,300);
var cxt = can.getcontext(“2d”);
var gradient = cxt.createlineargradient(0.5,0.5,0,150);
gradient.addcolorstop(0,’#00ff00′);
gradient.addcolorstop(1,’#ff0000′);
cxt.fillstyle=gradient;
cxt.fillrect(0,0,60,支付宝密码修改200);
var ox= can.offtleft
var oy = can.offttop;
var span = document.createelement(“input”);
span.tattribute(“id”,”rgba”);
document.getelementbyid(“textres促销策略分析ult”).appendchild(span);
}
}
function showcurrentcolor(e){
var x = e.clientx – 8;
var y = e.clienty – 29;
var w = 10;
if(document.createelement(“canvas”)){
if(document.getelementbyid(“colorpicker”).getcontext){
var can = document.getelementbyid(“colorpicker”);
var cxt = can.getcontext(“2d”);
var gradient = cxt.createlineargradient(0.5,0.5,0,150);
var span = document.getelementbyid(“rgba”);
var imgdatas = cxt.getimagedata(ox,oy,10,200);
var imgdata = imgdatas.data;
var g = imgdata[4 *(w)*(y)+(x)*4 + 1];
var r = imgdata[4 *(w)*(y)+(x)*4];
var b = imgdata[4 *(w)*(y)+(x)*4 + 2];
var a = imgdata[4 *(w)*(y)+(x)*4 + 3];
span.value微信公众平台怎么用=”r=”+r+” g=”+ g+” b=建设银行贷款利率表221;+b +” a=”+a;
document.getelementbyid(“textresult”).appendchild(span);
}
}
}
</script>
</body>
</html>
本文发布于:2023-04-03 07:36:54,感谢您对本站的认可!
本文链接:https://www.wtabcd.cn/fanwen/zuowen/b332f7fe99c20fa0d75bffae53dd5829.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文word下载地址:html5 学习简单的拾色器.doc
本文 PDF 下载地址:html5 学习简单的拾色器.pdf
留言与评论(共有 0 条评论) |