|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
I found this javascript on the site for rotating a set of quotes, and have modified it, as I want it to change the quotes without having to re-load the page. However, I don't know how to get it to show the text outside a text box which is what it currently does. I'd like the quote to appear in on a page in a column, so would like the text to be able to wrap.
Any ideas would be most appreciated Thanks Here's the text: //************************** <html> <head> <title>Quotes</title> <TITLE>Change Quote</TITLE> </head> <body topmargin="0" leftmargin="0" onLoad="writemsg()"> <P>before quote</P> <form method="get" name="form1"> <input type="text" size="50" name="tester" value="hi there"> </form> <div name=div1> <p name="after"> after quote </P> </div> <SCRIPT language="javascript"><!-- var howMany = 41 var quote = new Array(howMany+1) quote[0]="Force, and fraud, are in war the two cardinal virtues." quote[1]="War is the great scavenger of thought." quote[2]="War is the supreme drama of a completely mechanized society." quote[3]="The quickest way of ending a war is to lose it." quote[4]="Anyone who has ever looked into the glazed eyes of a soldier dying on the battlefield will think hard before starting a war." quote[5]="There is nothing so subject to the inconstancy of fortune as war." quote[6]="War is regarded as nothing but the continuation of politics by other means." quote[7]="It takes twenty years or more of peace to make a man; it takes only twenty seconds of war to destroy him." quote[8]="I'm trying to die correctly, but it's very difficult, you know." quote[9]="All men think all men mortal, but themselves." quote[10]="Life yields only to the conqueror. Never accept what can be gained by giving in. You will be living off stolen goods, and your muscles will atrophy." quote[11]="I dream, therefore I exist." quote[12]="Society often forgives the criminal; it never forgives the dreamer." quote[13]="He who sleeps half a day has won half a life." quote[14]="While the doctors consult, the patient dies." quote[15]="Friends are like fiddle strings, they must not be screwed too tight." quote[16]="A friend to all is a friend to none." quote[17]="The calmest husbands make the stormiest wives." quote[18]="The shortest answer is doing." quote[19]="To talk without thinking is to shoot without aiming." quote[20]="When the sword of rebellion is drawn, the sheath should be thrown away." quote[21]="The mob has many heads but no brains." quote[22]="Speak not of my debts unless you mean to pay them." quote[23]="A blind man will not thank you for a looking-glass." quote[24]="He that is born to be hanged shall never be drowned." quote[25]="A country can be judged by the quality of its proverbs." quote[26]="Flattery makes friends and truth makes enemies." quote[27]="Life without a friend is death without a witness." quote[28]="Translators, traitors." quote[29]="If a man deceives me once, shame on him; if he deceives me twice, shame on me." quote[30]="The nail that sticks up will be hammered down." quote[31]="There are many paths to the top of the mountain, but the view is always the same." quote[32]="Do not use a hatchet to remove a fly from your friend's forehead." quote[33]="Of all the thirty-six alternatives, running away is best." quote[34]="There is hope from the sea, but none from the grave." quote[35]="When the apple is ripe it will fall." quote[36]="Marry a mountain girl and you marry the whole mountain." quote[37]="Life is a bridge. Cross over it, but build no house on it." quote[38]="It is better to sit down than to stand, it is better to lie down than to sit, but death is the best of all." quote[39]="If your buttocks burn, you know you have done wrong." quote[40]="A wise man hears one word and understands two." quote[41]="The course of true love never did run smooth." function rndnumber(){ var randscript = -1 while (randscript < 0 | | randscript > howMany | | isNaN(randscript)){ randscript = parseInt(Math.random()*(howMany+1)) } return randscript } function writemsg(){ var quo = rndnumber() var quox = quote[quo] document.form1.tester.value = (quox) //document.div1.after.innertext = (quox) setTimeout("writemsg()", 2000); //return true; } //--></SCRIPT> </body> </html> |
|
#2
|
|||
|
|||
|
you could use layers and visibility.
have a hidden layer and a visible layer and just rotate between them all. the script won't work when it gets to the end ... i'm kinda tired and don't feel like looking at anymore javascript today. but that should get you started. //javascript quotes = new Array(); quotes[0] = "one"; quotes[1] = "two"; var x = 0; function rotate(){ if(document.all){ document.all(quotes[x]).style.visibility = 'visible'; document.all(quotes[x-1]).style.visibility = 'hidden'; } x++; if(x > quotes.length){ x = 0; } } //html <div id="one" style="position:absolute; visibility:hidden"> hello </div> <div id="two" style="position:absolute; visibility:hidden"> world </div> ------------------ Jaisen Mathai JMathai.com jaisen@jmathai.com [This message has been edited by jmathai (edited February 04, 2000).] [This message has been edited by jmathai (edited February 04, 2000).] |
|
#3
|
|||
|
|||
|
Just thought I'd update this very old thread with a link to a very old javascript example that answers the question in a different way:
www (dot) inquiry (dot) com (slash) techtips (slash) js_pro (slash) 10min (slash) 10min1299 (slash) 10min1299 (dot) asp (sorry about the link...I don't have my 5 posts or whatever but want to link this knowledge to this thread since the thread came up through my search on the topic) |
![]() |
| Viewing: Dev Shed Forums > Web Design > HTML Programming > Rotating Text Quotes |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|