Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Oct 2009
    Location
    Rizal Province, Philippines
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How to random content?

    I have a text file(quotes.txt) with 35+ quotations, separated by a single line break. Is it possible for a DIV to display a random quotation from quotes.txt each time the user visit my home page?

  • #2
    New to the CF scene
    Join Date
    Dec 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    HI,

    Easily display a random piece of content chosen from many on the page to your visitors using this script! Just wrap the participating contents each inside a DIV with a special CSS classname, and that's it! Furthermore, you can have multiple "groups" of random content, with the script picking one to display randomly for each group.

    This script comes with accessibility in mind- browsers with JavaScript disabled will simply see all the contents at once.

  • #3
    New Coder
    Join Date
    Oct 2009
    Location
    Rizal Province, Philippines
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you for the idea mdsraj. But I don't want to populate my page with hidden div's (if that's what you're suggesting) and displaying one div randomly. I want it to be retrieved from a text file so that when new quote or entry is available, I will just append it to the end of the text file and then save it. With div's, it will take a lot or at least more coding than with text file.

    Is that possible? Please show the script. Thanks

  • #4
    Regular Coder godofreality's Avatar
    Join Date
    Jan 2009
    Posts
    234
    Thanks
    1
    Thanked 15 Times in 15 Posts
    well ur looking for sum javascript to do a job for u and this is the html/css category so u most likely will not find much luck here u really should post this in the javascript section
    woot found the avatar options...i swear they didn't exist b4


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •