WeCodeThings Library
Library of code bits
Glossary    Contact Us
Need a web designer? visit WeCodeThings.Com for more details
Search  
   
Browse by Category


WeCodeThings Library .: ColdFusion .: How to display Random Quote using ColdFusion and the RandRange Function



How to display Random Quote using ColdFusion and the RandRange Function

  1. <!--- Be sure to change the 3 in  - #RandRange(1, 3)#  to match how many quotes you have --->
  2.  
  3. <!--- *************** No Appostrophy's in quoted text **********************************
  4. ****************************************************************************************
  5. ************************************EXAMPLE*********************************************
  6. *************** GOOD: I dont like this text.  ******************************************
  7. *************** BAD : I don't like this text. ****************************************** --->
  8.  
  9. <!--- Set random quotes here, separate each quote with a comma --->
  10. <cfset Quotes = "This is random quote 1, This is random quote 2, This is random quote 3">
  11. <cfset randomQuote = #RandRange(1, 3)#>
  12. <cfset displayQuote = #trim(listGetAt(Quotes, randomQuote))#>
  13. <script language="javascript">
  14.  function showtext(id,place){
  15.   d=document.getElementById(id);
  16.   d.innerHTML=place;
  17.  }
  18. </script>
  19. <!--- BODY --->
  20. <map name="Map" id="Map">
  21. <area shape="rect" coords="60,126,115,210" href="#" alt="Random Quote" onMouseOver="showtext
  22. ('thetext','<cfoutput>#displayQuote#</cfoutput>')" onMouseOut="showtext('thetext','')" />


How helpful was this article to you?

Related Articles

article Flex 3 Get Data from a CFC ColdFusion using bindable result handler function
More about creating a remote object and...

(No rating)  4-21-2009    Views: 888   
article PHP Mail Function Multiple Emails, People, To, or Recipients in Email PHP
When constructing the mail function with...

  5-27-2009    Views: 889   
article How to include a file with PHP using the includes and require function
The include() Function Simplest way to...

(No rating)  4-10-2009    Views: 417   

User Comments

Add Comment
No comments have been posted.




.: Powered by Lore .:Code by WeCodeThings Website Design and Development