SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast
    Join Date
    Nov 2005
    Posts
    42
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    i need a simple script, do u have one?

    hey
    i need a script that would display new peace of text every time the page loads. i dont know how can i do that but all i want to do is put a block on my page and display new peace of text at every pageload. like, random pictures or sth like the great words or sth,(i had seen such things on websites).
    i will prepare 100 peaces of text and want my first visitor see the text #1 and 88th see #1 but 101st visitor will see #1 again.
    would any of you who knows this kindof stuff tell me how can i do this, give a tutorial, script or i donno, sth that will enable me to do this
    thanks
    hello everyone!

  2. #2
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,840
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    I have instructions on how to create such code at http://javascript.about.com/library/blrand.htm
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  3. #3
    SitePoint Enthusiast
    Join Date
    Nov 2005
    Posts
    42
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thank you,
    it is nice simple and useful script but it displays random, cant i get one displaying in ordered way?
    hello everyone!

  4. #4
    SitePoint Wizard
    Join Date
    Jul 2003
    Location
    Kent
    Posts
    1,921
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    How will the javascript keep count of the visitor number????
    Javascript is executed client side when the page loads. So a random bit of text is the best you can do. How will visitor two know or even care that they are seeing a different bit of text to visitors one and three?

  5. #5
    SitePoint Enthusiast
    Join Date
    Nov 2005
    Posts
    42
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    mr john,
    i do not know, i asked if that is possible to help me out with that.
    one thing i forgot was that javascript works server side and does not ave database to keep count of number or visitors, you were right.

    thank you all for your help
    hello everyone!


Bookmarks

Posting Permissions

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