码迷,mamicode.com
首页 > 编程语言 > 详细

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

时间:2018-02-27 23:34:52      阅读:238      评论:0      收藏:0      [点我收藏+]

标签:tco   res   add   can   element   script   www   red   框架   

一、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>

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

标签:tco   res   add   can   element   script   www   red   框架   

原文地址:https://www.cnblogs.com/xinxianquan/p/8478030.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!