Thuộc tính văn bản Tiêu đề DOM HTML đặt / trả về giá trị của phần tử
của tài liệu. </P> <p>
Sau đây là cú pháp - </P> <p>
Trả về giá trị chuỗi </P> <pre>titleElementObject.text</pre> <p>
Đặt <strong> văn bản </strong> thành một giá trị chuỗi </P> <pre>titleElementObject.text = string</pre> <p>
Hãy để chúng tôi xem một 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='HTML DOM Title text Thuộc tính ' src="/article/uploadfiles/202203/2022033116531801.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='HTML DOM Title text Thuộc tính ' src="/article/uploadfiles/202203/2022033116531831.jpg" /> </P> <br>
</article>
<div class="ad5">
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-4480737146802772" crossorigin="anonymous"></script><!-- computer.wsxdn --><ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-4480737146802772" data-ad-slot="4467655591" data-ad-format="auto" data-full-width-responsive="true"></ins><script> (adsbygoogle = window.adsbygoogle || []).push({}); </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/1003065364.html' >HTML DOM touchcancel Event </a>
</section>
</div>
<div class="page down f-align">
<section>
<a class='LinkNextArticle' href='https://vn.wsxdn.com/fd034x/om351g/1003065366.html' >Thuộc tính tiêu đề HTML DOM </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/1003064945.html" class="text r-over r-over-3" title="HTML DOM Input Text thuộc tính bắt buộc ">HTML DOM Input Text thuộc tính bắt buộc </a>
</div></li>
<li class="f-between f-align"><div>
<a href="https://vn.wsxdn.com/fd034x/om351g/1003064946.html" class="text r-over r-over-3" title="HTML DOM Input Text thuộc tính readOnly ">HTML DOM Input Text thuộc tính readOnly </a>
</div></li>
<li class="f-between f-align"><div>
<a href="https://vn.wsxdn.com/fd034x/om351g/1003064947.html" class="text r-over r-over-3" title="HTML DOM Input Text thuộc tính trình giữ chỗ văn bản ">HTML DOM Input Text thuộc tính trình giữ chỗ văn bản </a>
</div></li>
<li class="f-between f-align"><div>
<a href="https://vn.wsxdn.com/fd034x/om351g/1003064948.html" class="text r-over r-over-3" title="HTML DOM Input Thuộc tính mẫu văn bản ">HTML DOM Input Thuộc tính mẫu văn bản </a>
</div></li>
<li class="f-between f-align"><div>
<a href="https://vn.wsxdn.com/fd034x/om351g/1003065366.html" class="text r-over r-over-3" title="Thuộc tính tiêu đề HTML DOM ">Thuộc tính tiêu đề HTML DOM </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/1003064426.html" class="t-over" title="Thuộc tính DOM InternalText HTML ">Thuộc tính DOM InternalText HTML </a></li>
<li><a href="https://vn.wsxdn.com/fd034x/om351g/1003064451.html" class="t-over" title="Thuộc tính văn bản tùy chọn HTML DOM ">Thuộc tính văn bản tùy chọn HTML DOM </a></li>
<li><a href="https://vn.wsxdn.com/fd034x/om351g/1003064583.html" class="t-over" title="HTML Kiểu DOM Văn bản Thuộc tính Dòng chảy ">HTML Kiểu DOM Văn bản Thuộc tính Dòng chảy </a></li>
<li><a href="https://vn.wsxdn.com/fd034x/om351g/1003064584.html" class="t-over" title="HTML DOM Style textIndent Thuộc tính ">HTML DOM Style textIndent Thuộc tính </a></li>
<li><a href="https://vn.wsxdn.com/fd034x/om351g/1003064586.html" class="t-over" title="HTML Kiểu DOM Văn bản ">HTML Kiểu DOM Văn bản </a></li>
<li><a href="https://vn.wsxdn.com/fd034x/om351g/1003064588.html" class="t-over" title="HTML Kiểu DOM Văn bản ">HTML Kiểu DOM Văn bản </a></li>
<li><a href="https://vn.wsxdn.com/fd034x/om351g/1003064649.html" class="t-over" title="Thuộc tính không gian trắng kiểu DOM HTML ">Thuộc tính không gian trắng kiểu DOM HTML </a></li>
<li><a href="https://vn.wsxdn.com/fd034x/om351g/1003064652.html" class="t-over" title="Người dùng Kiểu HTML DOM Chọn Thuộc tính ">Người dùng Kiểu HTML DOM Chọn Thuộc tính </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/1003064653.html" class="t-title"><strong class="r-over r-over-2">HTML DOM Input Thuộc tính giá trị văn bản </strong></a>
</li>
<li>
<a href="https://vn.wsxdn.com/fd034x/om351g/1003064654.html" class="t-title"><strong class="r-over r-over-2">HTML Nhập DOM Kiểu văn bản Thuộc tính </strong></a>
</li>
<li>
<a href="https://vn.wsxdn.com/fd034x/om351g/1003064655.html" class="t-title"><strong class="r-over r-over-2">HTML DOM Input Thuộc tính kích thước văn bản </strong></a>
</li>
<li>
<a href="https://vn.wsxdn.com/fd034x/om351g/1003064861.html" class="t-title"><strong class="r-over r-over-2">Thuộc tính dir DOM HTML </strong></a>
</li>
<li>
<a href="https://vn.wsxdn.com/fd034x/om351g/1003064878.html" class="t-title"><strong class="r-over r-over-2">Thuộc tính đầu DOM HTML </strong></a>
</li>
<li>
<a href="https://vn.wsxdn.com/fd034x/om351g/1003064911.html" class="t-title"><strong class="r-over r-over-2">Thuộc tính tự động hoàn thành HTML DOM Form </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>