In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
这篇文章主要介绍"css3+html5怎么运用javascript做一个简易画板",在日常操作中,相信很多人在css3+html5怎么运用javascript做一个简易画板问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答"css3+html5怎么运用javascript做一个简易画板"的疑惑有所帮助!接下来,请跟着小编一起来学习吧!
html:
颜色版:
笔触:
css:
*{ margin:0; padding:0;}
body{ background:#000;}
canvas{ background:#fff; float:left;}
span{ color:#fff; font-size:80px;}
#ul1{width:100px;height:600px; float:left; background:#ccc;}
_javascript:
_window.onload=function(){
var oC=document.getElementById('c1');
var oColor=document.getElementById('color');
var oNum=document.getElementById('num');
var gd=oC.getContext('2d');//画笔
oNum.onchange=function(){
gd.lineWidth = oNum.value;
strokeFn();
};
oColor.onchange=function(){
gd.strokeStyle = oColor.value;
strokeFn();
};
strokeFn();
function strokeFn(){
gd.beginPath();
oC.onmousedown=function(ev){
gd.moveTo(ev.clientX,ev.clientY);
oC.onmousemove=function(ev){
gd.lineTo(ev.clientX,ev.clientY);
gd.stroke();
};
oC.onmouseup=function(){
oC.onmousemove=oC.onmouseup=null;
};
return false;
};
}
};
到此,关于"css3+html5怎么运用javascript做一个简易画板"的学习就结束了,希望能够解决大家的疑惑。理论与实践的搭配能更好的帮助大家学习,快去试试吧!若想继续学习更多相关知识,请继续关注网站,小编会继续努力为大家带来更多实用的文章!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.