Text Change Upon Refresh?, i'm a noob, i know |
Text Change Upon Refresh?, i'm a noob, i know |
boomkin40 |
Aug 3 2013, 11:23 PM
Post
#1
|
Group: Members Posts: 2 Joined: 31-July 13 Member No.: 19,495 |
Hi,
I'm trying to figure out some way to have text in a tumblr description box change whenever someone comes onto my blog or refreshes it. I discovered this but it's for images... How can I do the same except with text? Thank you so much in advance! |
CharlesEF |
Aug 4 2013, 12:10 AM
Post
#2
|
Programming Fanatic Group: Members Posts: 1,996 Joined: 27-April 13 From: Edinburg, Texas Member No.: 19,088 |
Well, how about something like this:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Random Text</title> </head> <body> <div> <script language="JavaScript" type="text/javascript">// <![CDATA[ // <![CDATA[ function random_imglink(){ var myimages=new Array() //specify random images below. You can have as many as you wish myimages[1]="This is text1." myimages[2]="This is text2." myimages[3]="This is text3." myimages[4]="This is text4." myimages[5]="This is text5." myimages[6]="This is text6." var ry=Math.floor(Math.random()*myimages.length) if (ry==0) ry=1 document.write('<p>'+myimages[ry]+'</p>') } random_imglink() // ]]]]><![CDATA[> // ]]></script> </div> </body> </html> This is only a down and dirty sample and I placed the code inside a <div>, which you may or may not need. I'm sure you will need to do some more work on it to fit your needs (hey, I'm not going to do all the work ). Also, if the user has javascript turned off then you should also have a <noscript> section to display some default text. Hope this helps, Charles This post has been edited by CharlesEF: Aug 4 2013, 12:21 AM |
Lo-Fi Version | Time is now: 13th December 2024 - 11:57 PM |