Results 1 to 5 of 5

Thread: scrolling text box with time limits on subjects?

  1. #1
    Join Date
    Jan 2006
    Location
    Loveland, CO
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default scrolling text box with time limits on subjects?

    I have a client who wants to have a "calendar of events" scrolling box. She also wants to have a set time limit...when the date of the event is over, the item is automatically deleted from the scrolling calendar. And if that's not enough, she also wants to be able to easily change and add new events. This sounds like a lot to me, but I'm a uber-newbie. I already have the JS for the scrolling text box. Thanks in advance!

  2. #2
    Join Date
    Jan 2006
    Location
    Loveland, CO
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hey, anyone out there who can even tell me if this is possible at all would be greatly appreciated! Anyone? Some genius?

  3. #3
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    29,074
    Thanks
    44
    Thanked 3,216 Times in 3,178 Posts
    Blog Entries
    12

    Default

    Possible, yes. How much is your client willing to pay for this? Anyways, one would start with or create a scrolling type thing (many free examples of which are in the DD script library and elsewhere on the web). Now, some of these type scripts work off of an array of entries. This array could be made multidimensional and an entry in each entry's array could be the expiration date. Those that have expired could be culled using a test against the current date (either on the server or user's machine), prior to the array's use by the rest of the script to populate the scroller. Example of plain array to populate a scroller (from Pausing up-down message scroller):

    Code:
    //configure the below variable to change the contents of the scroller
    var messages=new Array()
    messages[0]="<font face='Arial'><a href='http://www.dynamicdrive.com'>Click here to go back to Dynamicdrive.com frontpage</a></font>"
    messages[1]="<font face='Arial'><a href='http://javascriptkit.com'>Visit JavaScriptKit for award winning JavaScript tutorials</a></font>"
    messages[2]="<font face='Arial'><a href='http://www.codingforums.com'>Get help on scripting and web development. Visit CodingForums.com!</a></font>"
    messages[3]="<font face='Arial'><a href='http://www.freewarejava.com'>Looking for Free Java applets? Visit Freewarejava.com!</a></font>"
    messages[4]="<font face='Arial'><a href='http://dynamicdrive.com/link.htm'>If you find this script useful, please click here to link back to Dynamic Drive!</a></font>"
    Now the array can be made multidimensional using this technique (additions red):

    Code:
    messages[0]=["<font face='Arial'><a href='http://www.dynamicdrive.com'>Click here to go back to Dynamicdrive.com frontpage</a></font>", "5/25/2006"]
    With that change, everywhere in the script that used to use messages[0] (messages[x]), for the content of the message would now need to use messages[0][0] (messages[x][0]), and so on for the rest of the entries. An expiration date can be set for each entry (an empty field could be used for no expiration, but would have to be tested for as well as the date then). To add entries is simple, they just get tacked onto the end of the array and to remove entries before displaying them, if they have expired, can be accomplished by testing messages[x][1] against the current date and using the splice() method, removing them before populating the scroller. It would be a good idea to periodically remove expired entries but, this could be done at one's leisure. Entries would need to maintain consecutive number sequence (when added and especially when removed) for the array to be valid for use by the script.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  4. #4
    Join Date
    Jan 2006
    Location
    Loveland, CO
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    John,

    Thanks for the info. Sorry 'bout the delay. They haven't sent even as much as copy or anything else to me yet, but you can bet they'll want it done in two days when it gets here.

    Hope I can figure out what you said! Like I mentioned, I'm an old graphics guy, and the only codes I know are some VERY basic html, and zip codes!

  5. #5
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    29,074
    Thanks
    44
    Thanked 3,216 Times in 3,178 Posts
    Blog Entries
    12

    Default

    Once you get some code post your best shot or, better yet put up a working or non-working demo and supply a link. In addition to the methods and means I outlined above, you will need to use the new Date() object and some of the date object's get methods, like .getDate() and .getMonth(), etc. to craft a string to compare to the date entry in the message array entries.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

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
  •