Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

auto text change

Status
Not open for further replies.

grebo

Programmer
Sep 21, 1998
38
US
This is probably rather elementary (to some of you, not to name names robherc...) ;)<br>
<br>
I'm trying to write a script that will display a random quote and then change itself every 5 seconds or so. I can do a slide show of pictures and display a random quote on reload, but am trying to combine them so that the quote randomizes on its own without reloading the page in any way. I'd like to ry and keep this out of a form box if possible too.<br>
<br>
Thanks.<br>
-Eric
 
Hmmmmmmm...... OUT of a form box you say???<br>
Sorry, I don't know of any way to do this OUTSIDE of a form box (unleff you use iframes, but I haven't been able to use them to work properly with JS yet)<br>
But a way that you can do what you are wanting IN a form box follows:<br>
<br>
&lt;html&gt;<br>
&lt;head&gt;<br>
&lt;script language=javascript&gt;<br>
&lt;!--hide<br>
<br>
var quotes="quote1,quote2,quote3";<br>
quotes.split(",");<br>
var number=quotes.length;<br>
number=parseint(number);<br>
<br>
function display_quote<br>
{<br>
var quote=math.random()*number+1;<br>
document.quoteform.quotebox.value=quotes
;<br>
var display=settimeout("display_quote",5000);<br>
}<br>
<br>
//--&gt;<br>
&lt;/script&gt;<br>
&lt;/head&gt;<br>
&lt;body onload=display_quote&gt;<br>
&lt;form name=quoteform onSubmit="return false;"&gt;<br>
&lt;input type=text name=quotebox&gt;<br>
&lt;/form&gt;<br>
&lt;/body&gt;<br>
&lt;/html&gt;<br>
<br>
<br>
<br>
<br>
Hope this helps you some (at least until someone figures out how to do it OUTSIDE of a form element {hmmm, maybe I COULD make it work with a form BUTTON though...LOL})<br>
<br>
<br>
-Name Not Mentioned<br>
<br>
Ha Ha!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top