Computer >> Máy Tính >  >> Lập trình >> HTML

Đối tượng Tiêu đề DOM HTML

Đối tượng Tiêu đề DOM HTML trong HTML đại diện cho phần tử . </P> <p> Tạo <strong> <title> </strong> phần tử </P> <pre>var titleObject = document.createElement(“TITLE”)</pre> <p> Đây, “<strong> titleObject” </strong> có thể có các thuộc tính sau - </P> <table> <thead> <tr valign ="TOP"> <th> Thuộc tính <br> </th> <th> Mô tả <br> </th> </tr> </thead> <tbody> <tr valign ="TOP"> <td width ="200"> text <br> </td> <td width ="371"> Itsets / trả về giá trị của phần tử <title> của thedocument <br> </td> </tr> </tbody> </table> <p> Hãy để chúng tôi xem ví dụ về <strong> Văn bản tiêu đề </strong> tài sản - </P> <h2> Ví dụ </h2> <pre><!DOCTYPE html> <html> <head> <title id="titleSelect">HTML DOM Title text</title> <style>    form {       width:70%;       margin: 0 auto;       text-align: center;    }    * {       padding: 2px;       margin:5px;    }    input[type="button"] {       border-radius: 10px; } </style> </head> <body>    <form>       <fieldset>          <legend id="legendSelect"></legend>          <input type="button" onclick="getTitleText()" value="What's the title of document?">          <div id="divDisplay"></div>       </fieldset>    </form> <script>    var divDisplay = document.getElementById("divDisplay");    var legendSelect = document.getElementById("legendSelect");    var titleSelect = document.getElementById("titleSelect");    function getTitleText() {       divDisplay.textContent = 'Title of document: '+titleSelect.text;       legendSelect.textContent = titleSelect.text.split(' ').join('-');    } </script> </body> </html></pre> <h2> Đầu ra </h2> <p> Trước khi nhấp vào <strong> ‘Tiêu đề của tài liệu là gì?’ </strong> nút - </P> <p> <img loading='lazy' alt='Đối tượng Tiêu đề DOM HTML ' src="/article/uploadfiles/202203/2022033116532137.jpg" /> </P> <p> Sau khi nhấp vào <strong> ‘Tiêu đề của tài liệu là gì?’ </strong> nút - </P> <p> <img loading='lazy' alt='Đối tượng Tiêu đề DOM HTML ' src="/article/uploadfiles/202203/2022033116532123.jpg" /> </P> <br> </article> <div class="ad5"> <script language='javascript' src='https://vn.wsxdn.com/css/ad/vn2.js'></script> </div> </section> <div id="turn-page" class="f-between"> <div class="page up f-align"> <i class="prev"></i> <section> <a class='LinkPrevArticle' href='https://vn.wsxdn.com/fd034x/om351g/1003065366.html' >Thuộc tính tiêu đề HTML DOM </a> </section> </div> <div class="page down f-align"> <section> <a class='LinkNextArticle' href='https://vn.wsxdn.com/fd034x/om351g/1003065368.html' >Thuộc tính sự kiện HTML DOM timeStamp </a> </section> <i class="next"></i> </div> </div> <section class="box4-l-list"> <div class="imgList f-between banner"> <ul class="f-between"> <li class="f-between f-align"><div> <a href="https://vn.wsxdn.com/fd034x/om351g/1003064894.html" class="text r-over r-over-3" title="Đối tượng chân trang DOM HTML ">Đối tượng chân trang DOM HTML </a> </div></li> <li class="f-between f-align"><div> <a href="https://vn.wsxdn.com/fd034x/om351g/1003064995.html" class="text r-over r-over-3" title="Đối tượng Chi tiết DOM HTML ">Đối tượng Chi tiết DOM HTML </a> </div></li> <li class="f-between f-align"><div> <a href="https://vn.wsxdn.com/fd034x/om351g/1003065091.html" class="text r-over r-over-3" title="Đối tượng HTML DOM Textarea ">Đối tượng HTML DOM Textarea </a> </div></li> <li class="f-between f-align"><div> <a href="https://vn.wsxdn.com/fd034x/om351g/1003065239.html" class="text r-over r-over-3" title="Đối tượng nhân sự HTML DOM ">Đối tượng nhân sự HTML DOM </a> </div></li> <li class="f-between f-align"><div> <a href="https://vn.wsxdn.com/fd034x/om351g/1003065382.html" class="text r-over r-over-3" title="Đối tượng HTML DOM Ul ">Đối tượng HTML DOM Ul </a> </div></li> </ul> </div> </section> </section> <aside class="box-r box4-r"> <div class="articleList"> <em>Bài báo nổi tiếng</em> <ol> <li><a href="https://vn.wsxdn.com/fd034x/om351g/1003064435.html" class="t-over" title="HTML DOM Đối tượng HTML ">HTML DOM Đối tượng HTML </a></li> <li><a href="https://vn.wsxdn.com/fd034x/om351g/1003064541.html" class="t-over" title="Đối tượng tham số DOM HTML ">Đối tượng tham số DOM HTML </a></li> <li><a href="https://vn.wsxdn.com/fd034x/om351g/1003064542.html" class="t-over" title="Đối tượng tập lệnh HTML DOM ">Đối tượng tập lệnh HTML DOM </a></li> <li><a href="https://vn.wsxdn.com/fd034x/om351g/1003064643.html" class="t-over" title="Đối tượng HTML DOM S ">Đối tượng HTML DOM S </a></li> <li><a href="https://vn.wsxdn.com/fd034x/om351g/1003064661.html" class="t-over" title="Đối tượng Tóm tắt HTML DOM ">Đối tượng Tóm tắt HTML DOM </a></li> <li><a href="https://vn.wsxdn.com/fd034x/om351g/1003064733.html" class="t-over" title="Đối tượng HTML DOM li ">Đối tượng HTML DOM li </a></li> <li><a href="https://vn.wsxdn.com/fd034x/om351g/1003064748.html" class="t-over" title="Đối tượng liên kết HTML DOM ">Đối tượng liên kết HTML DOM </a></li> <li><a href="https://vn.wsxdn.com/fd034x/om351g/1003064773.html" class="t-over" title="Đối tượng bài viết HTML DOM ">Đối tượng bài viết HTML DOM </a></li> </ol> </div> <section> <strong class="list-title"> <p>Máy Tính</p> <span></span> </strong> <ol class="texts"> <li> <a href="https://vn.wsxdn.com/fd034x/om351g/1003064801.html" class="t-title"><strong class="r-over r-over-2">Đối tượng HTML DOM Body </strong></a> </li> <li> <a href="https://vn.wsxdn.com/fd034x/om351g/1003064813.html" class="t-title"><strong class="r-over r-over-2">Đối tượng HTML DOM Code </strong></a> </li> <li> <a href="https://vn.wsxdn.com/fd034x/om351g/1003064843.html" class="t-title"><strong class="r-over r-over-2">Đối tượng HTML DOM DD </strong></a> </li> <li> <a href="https://vn.wsxdn.com/fd034x/om351g/1003064845.html" class="t-title"><strong class="r-over r-over-2">Đối tượng Datalist HTML DOM </strong></a> </li> <li> <a href="https://vn.wsxdn.com/fd034x/om351g/1003064854.html" class="t-title"><strong class="r-over r-over-2">Đối tượng HTML DOM DT </strong></a> </li> <li> <a href="https://vn.wsxdn.com/fd034x/om351g/1003064859.html" class="t-title"><strong class="r-over r-over-2">Đối tượng dl HTML DOM </strong></a> </li> </ol> </section> <ul class="typeList container f-start box4-typeList"> <li><a class='childclass' href='https://vn.wsxdn.com/fd034x/sq344k/' target="_self">lập trình C</a></li> <li><a class='childclass' href='https://vn.wsxdn.com/fd034x/ay345t/' target="_self">C ++</a></li> <li><a class='childclass' href='https://vn.wsxdn.com/fd034x/zx346r/' target="_self">Redis</a></li> <li><a class='childclass' href='https://vn.wsxdn.com/fd034x/nk347f/' target="_self">Lập trình BASH</a></li> <li><a class='childclass' href='https://vn.wsxdn.com/fd034x/ur348m/' target="_self">Python</a></li> <li><a class='childclass' href='https://vn.wsxdn.com/fd034x/ca349u/' target="_self">Java</a></li> <li><a class='childclass' href='https://vn.wsxdn.com/fd034x/hf350z/' target="_self">Cơ sở dữ liệu</a></li> <li><a class='childclass' href='https://vn.wsxdn.com/fd034x/om351g/' target="_self">HTML</a></li> <li><a class='childclass' href='https://vn.wsxdn.com/fd034x/tr352l/' target="_self">Javascript</a></li> <li><a class='childclass' href='https://vn.wsxdn.com/fd034x/ay353s/' target="_self">Lập trình</a></li> <li><a class='childclass' href='https://vn.wsxdn.com/fd034x/jg354b/' target="_self">CSS</a></li> <li><a class='childclass' href='https://vn.wsxdn.com/fd034x/nl355g/' target="_self">Ruby</a></li> <li><a class='childclass' href='https://vn.wsxdn.com/fd034x/mk356e/' target="_self">SQL</a></li> <li><a class='childclass' href='https://vn.wsxdn.com/fd034x/ge357z/' target="_self">IOS</a></li> <li><a class='childclass' href='https://vn.wsxdn.com/fd034x/ec358x/' target="_self">Android</a></li> <li><a class='childclass' href='https://vn.wsxdn.com/fd034x/ol359g/' target="_self">MongoDB</a></li> <li><a class='childclass' href='https://vn.wsxdn.com/fd034x/vt360n/' target="_self">MySQL</a></li> <li><a class='childclass' href='https://vn.wsxdn.com/fd034x/vt361n/' target="_self">C#</a></li> <li><a class='childclass' href='https://vn.wsxdn.com/fd034x/wu365o/' target="_self">PHP</a></li> <li><a class='childclass' href='https://vn.wsxdn.com/fd034x/us371m/' target="_self">SQL Server</a></li> </ul> </aside> </section> <footer class="container"> <span class="container f-center"> Bản quyền © <a href="https://vn.wsxdn.com">https://vn.wsxdn.com</a> Đã đăng ký Bản quyền </span> </footer> </body> </html>