Html5的新特性學習

 <!DOCTYPE html>

<html>

    <head>

        <meta charset="utf-8">

        <title>Html5的學習</title>

    </head>

    <body>


        <!--

            第一個:

            描述:<article> 標籤規定獨立的自包含內容。

                  <aside> 標籤定義其所處內容之外的內容。aside 的內容應該與附近的內容相關

        -->

        <article>

            <h1 align="center">html5新特性的學習--大標題</h1>

            <p>大標題---下的主要內容</p>

            <aside>

                <h3 align="middle">html5主要的學習 ---小標題</h3>

                <p>小標題----的詳細內容</p>

            </aside>

        </article>


        <!--

            第二個:

            描述:繪製圖形動畫

                 canvas 元素本身是沒有繪圖能力的。所有的繪製工作必須在 JavaScript 內部完成:

        -->

        <canvas id="canvar" width="800" height="200" style="background: yellow"></canvas>

        <script>

            var c = document.getElementById("canvar"); //得到繪畫的對象

            var context = c.getContext("2d"); //創建 context 對象

            //繪製直線

            context.moveTo(30, 50); //把路徑移動到畫布中的指定點,不繪製線條(橫、豎)

            context.lineTo(80, 70); //添加一個新點,剛開始的點到最後一個點的線條(橫、豎)

            context.lineTo(120, 30);

            context.stroke(); //最後將線條顯示出來(必須)

            //繪製一個實心圓

            context.fillStyle = "#00ff00" //圓填充後的顏色

            context.beginPath(); //開始一個新的起點

            context.arc(200, 45, 40, 0, Math.PI * 2, true); //畫一個圓形

            context.closePath(); //創建當前點到起始點的路徑

            context.fill(); //填充當前的繪畫

            //繪製一個空心圓

            context.strokeStyle = "#ff0000" //空心圓的顏色

            context.beginPath(); //開始一個新的起點

            context.arc(300, 45, 40, 0, Math.PI * 2, true); //畫一個圓形

            context.closePath(); //創建當前點到起始點的路徑

            context.stroke(); //填充當前的繪畫

        </script>

        <br />


        <!--

             第三個:

            描述:<datalist> 標籤定義可選數據的列表。相當於spinner(下拉選擇)

         -->

        <input id="myCar" list="cars" />

        <datalist id="cars">

            <option value="php">

                <option value="java">

                    <option value="android">

                        <option value="ios">

                            <option value="web">

        </datalist>

        <br />

        <br />


        <!--

            第四個:

            描述:<details> 標籤定義元素的細節,用戶可進行查看,或通過點擊進行隱藏。

                  <details> 標籤用於描述文檔或文檔某個部分的細節。<summary>是其第一個子元素。(相當於二級菜單列表)

        -->

        <details>

            <summary>家人</summary>

            &nbsp; 爸爸

            <br /> &nbsp; 媽媽

        </details>

        <br />


        <!--

            第五個:

            描述: <figure>定義媒介內容的分組,以及它們的標題。

                  <figcaption> 標籤定義 figure 元素的標題。

        -->

        <figure>

            <figcaption> &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot; 恆博教育 &quot; </figcaption>

            <img src="http://www.hengboit.com/images/wutu3.jpg" width="350" height="234" />

        </figure>





       <!--

            第六個:

            描述:<header> 標籤定義 section 或 document 的頁眉。

        -->

        <header>

            <h1>section或document的頁眉</h1>

        </header>

        <hander>

            <h1>section或document 的頁眉</h1>

        </hander>


        <!--

            第七個:

            描述:<footer> 標籤定義 section 或 document 的頁腳。

        -->

        <footer>

            <p>section或document的頁腳,包含創作者、日期、聯繫信息等</p>

        </footer>


        <!--

            第八個:

            描述:<keygen> 標籤定義生成密鑰。

                  <form></form> 提交

        -->

        <form action="http://www.w3school.com.cn/example/html5/demo_form.asp" method="get">

            用戶名:

            <input type="text" name="usr_name" />

            <br/> 加&nbsp;密:

            <keygen name="security" />

            <input type="submit" />

        </form>

        <br />


        <!--

            第九個:

            描述:<mark>主要用來在視覺上向用戶呈現那些需要突出的文字(高亮顯示)

        -->

        <p align="left">你是誰?我是

            <mark> &quot; 高慧鳳 &quot; </mark>

        </p>




       <!--
            第十個:
            描述:視頻播放   <video>   <source> 標籤爲媒介元素
        -->
        <div style="text-align-last: center;">
            <button οnclick="playpause()">暫停/播放</button>
            <button οnclick="makemax()">大</button>
            <button οnclick="makezhong()">中</button>
            <button οnclick="makesmall()">小</button>
            <video id="myvideo" width="700" style="margin-top: 15px" loop="loop" muted="muted" preload="auto">
                <source src="http://ht-mobile.cdn.turner.com/nba/big/teams/kings/2014/12/12/HollinsGlassmov-3462827_8382664.mp4" type="audio/mp4"></source>
            </video>
        </div>
        <br />
        <br />
        <script type="text/javascript">
            var myvideo = document.getElementById("myvideo");
            //視頻的暫停和播放
            function playpause() {
                if (myvideo.paused) {
                    myvideo.play();
                } else {
                    myvideo.pause();
                }
            }

            function makemax() {
                myvideo.width = 700;
            }

            function makezhong() {
                myvideo.width = 640;
            }

            function makesmall() {
                myvideo.width = 550;
            }
        </script>



        <!--
            第十一個:
            描述: <dialog> 標籤定義對話
        -->
        <button id="open">打開窗口</button>
        <button id="modal">打開模態窗口</button>
        <button id="close">關閉窗口</button>

        <dialog>
            <p>我是一個dialog</p>
            <button>關閉</button>
        </dialog>
        <br />
        <br />

        <script>
            document.querySelector('#open').onclick = function() {
                document.querySelector('dialog').show() //打開對話框不影響對其他的操作
            }
            document.querySelector('#modal').onclick = function() {
                document.querySelector('dialog').showModal() //打開對話框後什麼操作也不能做
            }
            document.querySelector('#close').onclick = function() {
                document.querySelector('dialog').close()
            }
            document.querySelector('dialog>button').onclick = function() {
                document.querySelector('dialog').close()
            }
        </script>



        <!--
            第十二個:
            描述:<nav>標籤定義導航鏈接的部分。
        -->
        <nav>
            <a href="https://www.baidu.com">百度</a>
            <a href="http://www.apple.com">蘋果</a>
        </nav>



        <!--
            第十三個:
            描述:<progress> 標籤運行中的進程
        -->
        <progress id="prog" value="0" max="100"></progress>
        <input id="startBtn" type="button" value="start" οnclick="startProgress()" />
        <div id="numValue">0%</div>
        <br />
        <br />
        <script type="text/javascript">
            //當前進度
            var currProgress = 0;
            //進度條是否完成
            var done = false;
            //進度條計數的最大數值
            var total = 100;

            function startProgress() {
                //獲得進度條的標籤
                var prBar = document.getElementById("prog");
                //獲得開始按鍵
                var startButt = document.getElementById("startBtn");
                //顯示的進度百分比數值
                var val = document.getElementById("numValue");
                startButt.disabled = true;
                prBar.value = currProgress;
                val.innerHTML = Math.round((currProgress / total) * 100) + "%";
                currProgress++;
                if (currProgress > 100) done = true;
                if (!done)
                    setTimeout("startProgress()", 100);
                else {
                    document.getElementById("startBtn").disabled = false;
                    done = false;
                    currProgress = 0;
                }
            }
        </script>



        <!--
            第十四個:
            描述:<wbr>規定在文本中的何處適合添加換行符。
        -->
        <p>
            如果想學習 AJAX,那麼您必須熟悉 XML
            <wbr>Http
            <wbr>Request 對象。
        </p>
    </body>

</html>







發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章