Webmaster Forum


Go Back   Webmaster Forum > Web Development > Coding Forum

Coding Forum Problems with your code? Discuss coding issues, including JavaScript, PHP & MySQL, HTML & CSS, Flash & ActionScript, and more.


Reply
 
LinkBack Thread Tools Display Modes
Share |
  #1 (permalink)  
Old 05-07-2012, 12:01 AM
Contributing Member
Latest Blog:
None

 
Join Date: 03-21-07
Posts: 87
iTrader: 0 / 0%
How to make page title, auto refresh every x seconds (using javascript/jquery/others)

I have a php file lets say file1.php, that printing a variable, its dynamic numbers output that already always increasing, like private message numbers that coming or others :

PHP Code:
<?php
echo $variable
?>


i want to put that variable output, in another files page title, lets say file2.php or file3.html,
in the front of the another files page titles, and auto refresh every x seconds, maybe like this :

Quote:
(1) - another text in the page title
after x seconds, get a private message
Quote:
(2) - another text in the page title
after another x seconds, get another private message
Quote:
(3) - another text in the page title




or its ok if just like this, only the variable, without the another text in the page title
Quote:
(1)




please share your knowledge to make it, maybe using javascript, jquery or others
__________________
I like forum
 
Reply With Quote
  #2 (permalink)  
Old 05-07-2012, 02:30 AM
JohnnyS's Avatar
Contributing Member
 
Join Date: 07-05-11
Location: philippines
Posts: 312
iTrader: 0 / 0%
you can try this..

Code:
var page_titles = [{text:"Title 1",time:5},{text:"Title 2",time:10},{text:"Title 3",time:15}]; var page_index = 0; function update_title() { //get timeout need before title be replaced var timeout = page_titles[page_index]['time'] * 1000; // in milliseconds //get title to replace current title var title = page_titles[page_index]['title']; setTimeout(function(){ // set title document.title = title; // increase index page_index++; // check index if greater or equal page_titles item count then set to zero (start again) if(page_index >= page_titles.length) page_index=0; // recursive function call update_title(); },timeout); }
 
Reply With Quote
Go Back   Webmaster Forum > Web Development > Coding Forum

Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Auto refresh HTML? maplenexus Coding Forum 13 04-12-2011 09:52 AM
Learning jQuery before Javascript? xkw Coding Forum 1 03-27-2010 05:43 PM
jquery help, fade in title. thebigO Coding Forum 7 06-25-2009 07:04 AM


V7N Network
Get exposure! V7N I Love Photography V7N SEO Blog V7N Directory


All times are GMT -7. The time now is 02:02 AM.
Powered by vBulletin
Copyright © 2000-2013 Jelsoft Enterprises Limited.
Copyright © 2003 - 2013 Escalate Media LP




Search Engine Optimization by vBSEO 3.6.0 RC 2 ©2011, Crawlability, Inc.