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

來源:互聯網
上載者:User

標籤: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(九)

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.