Results 1 to 3 of 3

Thread: Memory Scroller Help

  1. #1
    Join Date
    May 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Memory Scroller Help

    hey, I am having trouble using the memory scroller script, It is exactly the type of scroller I am looking for but I am new to javascript and was wondering how you could include an external file as the message's content, such as php or html, instead of typing in a message of the text to be scrolled which occurs here:

    var memorycontent='<nobr><span style="font: bold 13px Verdana">Thank you for visiting <a href="http://www.dynamicdrive.com">Dynamic Drive.</a> If you find this script useful, please consider <a href="http://www.dynamicdrive.com/link.htm">linking to</a> or <a href="http://www.dynamicdrive.com/recommendit/">recommending</a> Dynamic Drive.</span></nobr>'

    the file is formatted such that it only shows up on one line. Appreciate any help you can give me.

  2. #2
    Join Date
    Aug 2004
    Posts
    10,140
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    The easiest way in this case, though not the most versatile, would just be to save your scroller contents inside an external .js file that appears above the memory scroller code itself. So inside something like "contents.js", you'd have:

    Code:
    var memorycontent='<nobr><span style="font: bold 13px Verdana">Thank you for visiting <a href="http://www.dynamicdrive.com">Dynamic Drive.</a> If you find this script useful, please consider <a href="http://www.dynamicdrive.com/link.htm">linking to</a> or <a href="http://www.dynamicdrive.com/recommendit/">recommending</a> Dynamic Drive.</span></nobr>'
    Then on your page, it'd be referenced as:

    Code:
    <script type="text/javascript" src="contents.js"></script>
    <script...>
    rest of memory scroller minus "memorycontent" variable here...
    </script>

  3. #3
    Join Date
    May 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I see what you're saying and that would work if I knew how to write the results of a php file to a javascript file because the file contents are constantly changing.

    I found another solution however that would work, if i could only find any other way to just rewrite the var memorycontent expression without the use of apostrophes. The content of the file is article titles and many of them have apostrophes, and i have cms that imports these titles directly into the code through a replacement tag, but then the code gets very confused.
    But I'm not sure how to rewrite this as i'm a newbie to javascript.

    So is there anyway to rewrite this var memorycontent expression without the use of any single apostrophes?

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
  •