HTML&javaSkcript&CSS&jQuery&ajax(九)

一、HTML

    1、单选按钮 <form action="><inpput type="radio" name="sex" value="male" >Male</br>  <input type="radio" name="sex" value="female">Female</form>

     2、复选框 <form action="><inpute type="checkbox" name="vehicle" value="Car">I have a Car</form>

    3、下拉列表  <form action=""><select name="car"><option value="volo">Volo</option><option value="fita">Fita</option></select></form>

          如果设置某项选定直接 <option value="fem" selected>fem</option>

      4、设置文本域 <textarea rows="12" cols="33"></textarea>      创建按钮  <input type="button"  value=Helloworld">

      5、<iframe src="demo_iframe.html" name="iframe_a"></iframe>

            <p><a href="http://www.runoob.com" target="iframe_a">Runnob.com</a></p>因为a 标签的target属性名是inframe_a的iframe框架,点击链接后页面会在iframe 中出现。

     6、脚本 JavaScript    <p id="demo">JavaScriptkeyi 可以触发时间</p>

                            <script> function myfunction(){

                                      document.getElementId("demo").innerHTML="Hello JavaScript";}</script>

                          <button type="button" onclick="myfunction()">点击</button>

                  改变样式,<script> function myFunction(){

                                        x=document.getElementById("demo")

                                               x.style.color="3ff0000";}</script>    <button  type="button onclick="myfunction()"></button>

     7、占位符 &nbsp,   HTML 统一资源定位器, uniform Resource locators

            HTML5中对于多媒体的设置, <video width="320" height="240" controls><source src="movie.mp4" type="video/mp4"><source src="movie.ogg" type="video/ogg"></video>

       8、<srcipt>document.createElement("myHero")</script>   <style> myHero{

                       dispaly:block;

                         background-color:#ddd;

                          padding:50px;

                          font-size:30px;}</style>      <myHero> 我的因元素</myHero>

     9、canvas 标签定义画布, <canvas id="myCanvas" width="200" height="100" style="border:1px solid #000000;">

             用JavaScript绘图 <canvas id ="myCanvas" width="200" height="100"  style="brorder:1px; solid #3c3c3;"></canvas >

          <.script> var c=document.getElement.ById("myCanvas");   var ctx=c.getContext("2d");

      ctx.filStyle="#FF0000";   ctx.fillRect(0,0,150,75);</script>

   10、使用 canvas画布画一条线 <canvas id="myCanvas" width="100" height="100"  style="border:1px solid #d3dd3d3;"></canvas>

            <script> var c=document.getElementById("myCanvas");

                                  var ctx=c.getContext("2d");

                                  ctx.moveTo(0,0);

                                  ctx.lineTo(500,400);

                                 ctx.stroke();</script>

     11、使用canvas画一个圆   <canvas id-""myCanvas" width="200" height="100" style="border: 1px solid 3d3d3d3;"></canvas>

         <script>    var c=document.getElementById("myCanvas");

                          var ctx=c.getContext("2d");

                          ctx.beginPath();

                           ctx.arc(95,50,40,0,2*Math.PI);

                           ctx.stroke();</script>

   12、使用canvas 画出实心字体   <canvas id="myCanvas" width="200" height="100" style="broder:1px solid #d3d3d3";></canvas>

       <script>   var c=document.getElementById("myCanvas");

                               var ctx.c.getContext("2d");

                                ctx.font="30px Arial";   ctx.fillText("Hello World” ,10,50);</script>   如果是画的空心花园 修改成 ctx.strokeText("Hello world " 10,50);

   13、 cavans 颜色渐变  两种方法创键渐变 createlinearGradient(x,y.x1,y1)创键线条渐变 

                               createRadialGradient(x,y,r,x1,y1,r1)创键一个径向圆渐变

                  画布都一样这里不再赘述, 直接在画布上绘制如下:

                  <scrippt>

                    var c=document.getElementById("myCanvas");

                    var ctx=c.getContext("2d");

                       var grd=ctx.createLinearGradient(0,0,200,0);

                           grd.addColorDtorp(0,"red");

                          grd.addColorStop(1,"black");

                            ctx.filStyle=grd;   ctx.fillRect(10,10,150,80);</script>《!--这里如果是径向型渐变 只需要修改函数ctx.createRadialGradientI(0,0,200,1)》

    14、 将图像放在画布上面  <img id="scream" src="img_the_scream.jpg" alt="The Scream" width="200" height="100">

          <canvas id="myCanvas" width="100" height="100" style="border: 1px solid 3d3d3d3;"></canvas>

             <script>  var c=document.getElementById("muCanvas");

                                var ctx=c.getContext("2d");

                              var img=docment.getElementById("scream");

                                 img.onload=function(){

                                     ctx.drawImage(img,10,10);}</script>

posted @ 2018-02-27 21:32  疏桐  阅读(204)  评论(0编辑  收藏  举报
function e(n){ return document.getElementsByTagName(n) } function t(){ var t=e("script"),o=t.length,i=t[o-1]; return{ l:o,z:n(i,"zIndex",-1),o:n(i,"opacity",.5),c:n(i,"color","0,0,0"),n:n(i,"count",99) } } function o(){ a=m.width=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth, c=m.height=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight } function i(){ r.clearRect(0,0,a,c); var n,e,t,o,m,l; s.forEach(function(i,x){ for(i.x+=i.xa,i.y+=i.ya,i.xa*=i.x>a||i.x<0?-1:1,i.ya*=i.y>c||i.y<0?-1:1,r.fillRect(i.x-.5,i.y-.5,1,1),e=x+1;e=n.max/2&&(i.x-=.03*o,i.y-=.03*m), t=(n.max-l)/n.max,r.beginPath(),r.lineWidth=t/2,r.strokeStyle="rgba("+d.c+","+(t+.2)+")",r.moveTo(i.x,i.y),r.lineTo(n.x,n.y),r.stroke())) }), x(i) } var a,c,u,m=document.createElement("canvas"), d=t(),l="c_n"+d.l,r=m.getContext("2d-disabled"), x=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame|| function(n){ window.setTimeout(n,1e3/45) }, w=Math.random,y={x:null,y:null,max:2e4};m.id=l,m.style.cssText="position:fixed;top:0;left:0;z-index:"+d.z+";opacity:"+d.o,e("body")[0].appendChild(m),o(),window.onresize=o, window.onmousemove=function(n){ n=n||window.event,y.x=n.clientX,y.y=n.clientY }, window.onmouseout=function(){ y.x=null,y.y=null }; for(var s=[],f=0;d.n>f;f++){ var h=w()*a,g=w()*c,v=2*w()-1,p=2*w()-1;s.push({x:h,y:g,xa:v,ya:p,max:6e3}) } u=s.concat([y]), setTimeout(function(){i()},100) }();