Truemag

  • Categories
    • Tips And Tricks
    • Internet
    • PHP
    • Javascript
    • CSharp
    • SQL Server
    • Linux
  • Lastest Videos
  • Our Demos
  • About
  • Contact
  • Home
  • Write With Us
  • Job Request
Home Javascript Auto Rotate Web Page Title With JavaScript

Auto Rotate Web Page Title With JavaScript

The following is a JavaScript function that changes/rotates title of webpage automatically in every specified number of seconds.

In the function, we use the setTimeout() JavaScript method to execute the change title function after a specified time-interval, every 1 second in this example.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
 
<body>
<script language="javascript">
	function rotate_title(onoff, delay)
	{
		var title1 = "4 Rapid Development";
		var title2 = "Website for developers, designers and webmaster";
 
		var title = "";
 
		var index = onoff;
 
		if(index == 0)
		{
			title = title1;
			index = 1;
		}
		else if(index == 1)
		{
			title = title2;
			index = 0;
		}
		document.title=title;
		timer=window.setTimeout("rotate_title("+index+"," + delay + ")",delay);
	}
	rotate_title(0,1000);
</script>
</body>
</html>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <script language="javascript"> function rotate_title(onoff, delay) { var title1 = "4 Rapid Development"; var title2 = "Website for developers, designers and webmaster"; var title = ""; var index = onoff; if(index == 0) { title = title1; index = 1; } else if(index == 1) { title = title2; index = 0; } document.title=title; timer=window.setTimeout("rotate_title("+index+"," + delay + ")",delay); } rotate_title(0,1000); </script> </body> </html>

rotate-webpage-title

rotate-webpage-title

+ [download id=”11″ format=”1″]
+ See how it works, just focus on the page title.

Feb 22, 2012Hoan Huynh
PHP Get Facebook URL Total Comments, Total Likes, Total SharesASP.NET JQuery Autocomplete Textbox
You Might Also Like:
  • Javascript Problem Set focus textbox on Firefox
  • How To Track Website With Multiple Google Analytisc Accounts
  • Create Count Down Download Page With JavaScript
  • Get Image Width Height With JQuery And JavaScript
  • Create Pie Chart With HTML & JavaScript
  • Facebook Like Button And Recommend Button With fb:like, iframe and html5
  • JavaScript Detect Protocol (HTTP/ HTTPS) To Load Or Handle Accordingly
  • JavaScript Display Leaving Confirm Box Leave This Page Or Stay On This Page
  • Auto Load YouTube Video As A Popup With JQuery FancyBox
  • JavaScript Get Radio Button Value
Hoan Huynh

Hoan Huynh is the founder and head of 4rapiddev.com. Reach him at [email protected]

9 years ago Javascriptdocument.title, setTimeout205
0
GooglePlus
0
Facebook
0
Twitter
0
Digg
0
Delicious
0
Stumbleupon
0
Linkedin
0
Pinterest
Most Viewed
PHP Download Image Or File From URL
21,918 views
Notepad Plus Plus Compare Plugin
How To Install Compare Text Plugin In Notepad Plus Plus
19,746 views
Microsoft SQL Server 2008 Attach Remove Log
Delete, Shrink, Eliminate Transaction Log .LDF File
15,583 views
JQuery Allow only numeric characters or only alphabet characters in textbox
13,094 views
C# Read Json From URL And Parse/Deserialize Json
9,557 views
4 Rapid Development is a central page that is targeted at newbie and professional programmers, database administrators, system admin, web masters and bloggers.
Recent Posts
  • Research Paper Writing Service
  • Annotated Bibliography Example – How it Can Help You
  • Essay Writing Online Tips – How to Write Essays Online With Essay Proof Editing
  • Get Research Paper Assistance From Professional Help
  • Customized Essay Writing Agency – Why You Want It
Categories
  • CSharp (45)
  • Facebook Graph API (19)
  • Google API (7)
  • Internet (87)
  • iPhone XCode (8)
  • Javascript (35)
  • Linux (28)
  • MySQL (16)
  • PHP (84)
  • Problem Issue Error (29)
  • Resources (32)
  • SQL Server (25)
  • Timeline (5)
  • Tips And Tricks (141)
  • Uncategorized (62)
Recommended
  • Custom Software Development Company
  • Online Useful Tools
  • Premium Themes
  • VPS
2014 © 4 Rapid Development