Use JS code to print and modify the title of the blog Park (or website)

Source: Internet
Author: User

The title belongs to a special node element in HTML.

Because it can use Doucment.getelementsbytagname ("title") [0] to get its title, it cannot change its value with Doucment.getelementsbytagname ("title") [0].

However, there is always a way to solve it. in JavaScript, the method of modifying the title is:

<script type="text/javascript">     'dinphy-cumin _ Line | Small knowledge, everyone enjoy, you can also do '; </script>

The node element between <body></body> is obtained or modified with document.getElementsByTagName (). DocumentElement represents everything in the middle of

JS will use Document.title to replace the title of the page because the Title,head,body and other tags are the default unique label, so Document.title and document.body can directly find the results. And the title is a structure of the label, that is, the title, can only join Nodetext. And can not add other elements, so its use and has a special. To keep the code from making an error, So JS in the provisions document.title this object has only one attribute (also can be said to have no attributes), Document.title itself is a property of the Document object, not one of its sub-object, in the use of document.title= "" To change the title.

Use JS code to print and modify the title of the blog Park (or website)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.