简体   繁体   English

如何使用 javascript 延迟 3 秒后更改 window 标题?

[英]How to change the window title after the 3 seconds delay by using javascript?

I need Change window title bar after 3 seconds delay我需要在延迟 3 秒后更改 window 标题栏

like this using javascript www.nazeer.com像这样使用 javascript www.nazeer.com

You can change the title using document.title = "value"您可以使用document.title = "value"更改标题

You can delay 3 seconds(3 * 1000 milliseconds) and then change using setTimeout function.您可以延迟 3 秒(3 * 1000 毫秒),然后使用setTimeout function 进行更改。

setTimeout(function(){
    document.title = "NEW TITLE"
}, 3000);

Here, 3000 is the time in milliseconds.这里,3000 是以毫秒为单位的时间。

Refer this more queries - How to dynamically change a web page's title?请参阅此更多查询 - 如何动态更改 web 页面的标题?

The following example is given Try This给出以下示例 Try This

 setTimeout(()=>{ window.document.title = "Your OWn"; console.log("changing Title"); },3000);

setTimeout( () => { window.document.title = 'Your title'}, 3000)

You can use setTimeout for delay, and window.document.title to change title/ Hope i help:)您可以使用setTimeout进行延迟,并使用window.document.title更改标题/希望我有帮助:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM