Changing text every few minutes on a page

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there a way in FP to create a section of a page where new text is
displayed every few minutes? We want to have paragraphs about what people
are saying about our new product as it is being put into production but want
them to change and not be static. Can this be done in FP and how. If not,
how. Thanks
 
Marcy said:
Is there a way in FP to create a section of a page where new text is
displayed every few minutes? We want to have paragraphs about what
people are saying about our new product as it is being put into
production but want them to change and not be static. Can this be
done in FP and how. If not, how. Thanks

I found this script from A1 JavaScripts.

I havent quite figured out what all the code is for - some of it seems
unnecessary.
(For example this seems to do nothing:
onFocus="self.status='This is a JavaScript information data field';
return true"
onBlur="self.status=''; return true"
and it works OK when it is deleted)

There are two timers in the code:
timer = setTimeout("idleMsg()",1500); // 1.5 seconds
timer = setTimeout("idleMsg()",2500); // 1.5 seconds

I have tested it and altering 1500 to 0 loads the first message immediately,
which I guess you would want.
The other controls the time between each message, so change it to whatever
you want.
(Every 3 minutes would be 3*60*1000 = 180000.)

You may need a larger space to put the message, so perhaps change <input
type ="text" .......> to <input type ="textarea" rows="10" cols="72".......>
You then have a problem in entering the text of each para. and the code to
pad it out would be redundant or need altering.

Anyway this may give you some ideas. If you have difficulty, I can give it
more thought. One thought is an Iframe which is loaded with a new file every
x milliseconds (be it 2500 or 180000)

<html>
<head>
<!-- ===================================================
part 1 enter your messages in this part notices = "Your message";
==================================================== -->
<script language="JavaScript">
var notices = new Array(
"A1 JavaScripts welcomes you to its website",
"Thank you for visiting, I hope you find what you are searching for",
"This is the example of the form text javascript.",
"Each message can be adjusted either in speed, or content",
"The length of the message box can also be personalized to fit your
needs.",
"More lines can be easily added to this script",
"Simply copy and paste the code into your page",
"Enjoy these scripts, and good luck with your site")
function update(msg)
{
var pad_str="";
n = msg.length;
if(n < 72)
{ pad = (73 - n) / 2;
for(var i = 0; i < pad; i++)
pad_str += " "; }

CurrentMsg = pad_str + msg;
document.messages.field.value = CurrentMsg;
clearTimeout(timer);
timer = setTimeout("idleMsg()",2500);
}
function nochange()
{ document.messages.field.value = CurrentMsg;}
function idleMsg()
{
update(notices[index++]);
if(index >= notices.length)
index = 0;
}
var index = 0;
var CurrentMsg = notices[0];
var timer = setTimeout('idleMsg()',1500);
</script>
</head>
<body>
<!--=========================================================
part 2 - put this where you want it to display
==========================================================-->
<center>
<font face="Helvetica">
<form name="messages" onSubmit="return false">
<input type="text" name="field" size=40 style="width:445" value=" "
onFocus="self.status='This is a JavaScript information data field';
return true"
onBlur="self.status=''; return true"
onChange="nochange()">
</form>
</font>
</center>
<!--======================================================-->
</body>
</html>
 
Trevor said:
I found this script from A1 JavaScripts.
Anyway this may give you some ideas. If you have difficulty, I can
give it more thought. One thought is an Iframe which is loaded with a
new file every x milliseconds (be it 2500 or 180000)

Here is an example of using an Iframe. The code is much simpler.

In notices, add the names of html files with the paras you want.
e.g. (contents of test3.html)
<p>
This is the para for test3<br>
test3<br>
test3<br>
test3<br>
test3<br>
test3<br>
This is a much longer closing sentence to see what happens when the line is
longer than the others
</p>

In the style for c1. you can alter the height and width of the Iframe. You
could also add a background colour or modify the font as you wish.

I think this should work for you.

CODE FOLLOWS
<html>
<head>
<!-- ===================================================
part 1 enter the names of your files in this part notices = "Your
message";
==================================================== -->
<script language="JavaScript">
var notices = new Array(
"test1.html",
"test2.html",
"test3.html")
var index = 0
var timer = setTimeout('newMsg()',0)
function newMsg()
{
update()
if(index >= notices.length)
index = 0
}
function update()
{
document.getElementById("Promos").src=notices[index++]
timer = setTimeout("newMsg()",2500);
}
</script>
<style type="text/css">
..c1 {
height: 200px;
width: 400px;
overflow: auto;
}
</style>
</head>
<body>
<!--=========================================================
part 2 - put this where you want it to display
==========================================================-->
<center>
<iframe class="c1" id="Promos" src=""></iframe>
</center>
<!--======================================================-->
</body>
</html>
 
Back
Top