Javascript to Cycle through random titles

  Post new topicReply to topicPrintable Version
<< View previous topic View next topic >>
Share: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
#1   Javascript to Cycle through random titles
GodlyMoose
CZ Newbie
GodlyMoose has been a member for over 19 year's 19 Year Member
usa.gif california.gif
Age: 34
Website:
Status: Offline
Joined: Apr 17, 2005
0.00 posts per day
Posts: 14
Points: 1,650
AIM Address Yahoo Messenger  
I'm looking for how it can cycle through different titles, and picking them at random.



Back to top Reply with quote
#2   
Telli
Site Admin
Occupation: Self Employed
Age: 46
Gender: Male
Fav. Sports Team: Detroit Red Wings
Website:
Status: Offline
Joined: May 26, 2003
1.03 posts per day
Posts: 8089
Points: 494,430
   
Do you have an example of what your trying to do?




_________________
The path of the righteous man is beset on all sides by the inequities of the selfish and the tyranny of evil men. Blessed is he, who in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother's keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy my brothers. And you will know my name is the Lord when I lay my vengeance upon thee. Ezekiel 25:17
Back to top Reply with quote
#3   re: Cycle through random titles
GodlyMoose
CZ Newbie
GodlyMoose has been a member for over 19 year's 19 Year Member
usa.gif california.gif
Age: 34
Website:
Status: Offline
Joined: Apr 17, 2005
0.00 posts per day
Posts: 14
Points: 1,650
AIM Address Yahoo Messenger  
Actually yeah, go to the [ Register or login to view links on this board. ] website, and look at the title. It changes each time you visit/refresh the site, and changes the title to a diffrent title. You might have to refresh or visit a couple times, then it will change.



Back to top Reply with quote
#4   re: Cycle through random titles
Telli
Site Admin
Occupation: Self Employed
Age: 46
Gender: Male
Fav. Sports Team: Detroit Red Wings
Website:
Status: Offline
Joined: May 26, 2003
1.03 posts per day
Posts: 8089
Points: 494,430
   
Ok i didnt see anything random there. I took a few and wrote you something that will display text randomly. Just edit the text_string's.


<script language="JavaScript1.2" type="text/javascript">
<!--
/*
Random Text Script
© 2002-2006 Telli (www.codezwiz.com)
Visit http://codezwiz.com/
*/
var text_string = new Array("Test Text #1", "Test Text #2", "Test Text #3", "Test Text #4", "Test Text #5", "Test Text #6", "Test Text #7", "Test Text #8", "Test Text #9", "Test Text #10");
var l = text_string.length;
var rand_num = Math.round((l-1)*Math.random());
document.write(text_string[rand_num]);
//-->
</script>


Change all the Test Text #1 - Test Text #10 with the 10 random titles you want. Add more or delete some if you like. Add the Javascript where you want the random text.



_________________
The path of the righteous man is beset on all sides by the inequities of the selfish and the tyranny of evil men. Blessed is he, who in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother's keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy my brothers. And you will know my name is the Lord when I lay my vengeance upon thee. Ezekiel 25:17
Back to top Reply with quote
#5   re: Javascript to Cycle through random titles
GodlyMoose
CZ Newbie
GodlyMoose has been a member for over 19 year's 19 Year Member
usa.gif california.gif
Age: 34
Website:
Status: Offline
Joined: Apr 17, 2005
0.00 posts per day
Posts: 14
Points: 1,650
AIM Address Yahoo Messenger  
Thanks for the script Telli. icon_mrgreen.gif
But I'm, not sure if that would work with the <title> tag, I'll check it out real quick to see if it will.



Back to top Reply with quote
#6   re: Javascript to Cycle through random titles
GoddsEgo
PayPal Donation
CZ Moderator
Status: Offline
Joined: Jun 26, 2003
0.15 posts per day
Posts: 1211
Points: 69,166
 Yahoo Messenger  
To apply the random text to the title just replace this line...

document.write(text_string[rand_num]);

With this one...

top.document.title = text_string[rand_num];



Back to top Reply with quote
#7   re: Javascript to Cycle through random titles
GodlyMoose
CZ Newbie
GodlyMoose has been a member for over 19 year's 19 Year Member
usa.gif california.gif
Age: 34
Website:
Status: Offline
Joined: Apr 17, 2005
0.00 posts per day
Posts: 14
Points: 1,650
AIM Address Yahoo Messenger  
Thanks guys, you have been a bunch of help for me.



Back to top Reply with quote
Display posts from previous:      
Add To: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
<< View previous topic View next topic >>
Post new topicReply to topic

Jump to 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum