The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Text Change Upon Refresh?, i'm a noob, i know
boomkin40
post 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!
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
CharlesEF
post Aug 4 2013, 12:10 AM
Post #2


This is My Life
*******

Group: Members
Posts: 1,438
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 biggrin.gif ). 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
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 23rd January 2018 - 04:38 AM