Last updated on May 12th, 2022 at 12:23 pm
The below script can be used to dynamically change title on the browser. There is a delay variable in the script you can modify it according to your convenience. By changing this value you can even Animate the web page title to an extend 🙂
In this tutorial we are updating document.title using Javascript.
<script type="text/javascript">
var message = new Array ();
var delay = 5000; // Sets the delay between switching messages
var currMessage = 1;
message[1] = "I am First";
message[2] = "I am Second";
message[3] = "I am Third";
function timer() {
document.title = (message[currMessage++]);
setTimeout("timer()",delay);
currMessage = ((currMessage >= message.length) ? 1 : currMessage);
}
timer();
</script>
If you would like to add more messages, add more values in the message array like below
message[1] = "I am First";
message[2] = "I am Second";
message[3] = "I am Third";
message[4]= "New Message";
Demo
Just add the above script on your webpage and see your title bar getting changed dynamically 🙂
not bad…good one admin…
A good website
what a website/.
a nice website..
cool site…
proper…the best
i like this site
a nice website
one of the best website for tutorials and scripts
a nice one..i like it..
A very good website especially for javascript and php
Cool website for title bar stuff using javascript 🙂 expecting more…..
Good article.