Results 1 to 2 of 2

Thread: DHTML Ticker Script Issue

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

    Default DHTML Ticker Script Issue

    1) Script Title: DHTML Ticker Script

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...eneraltick.htm

    3) Describe problem: In the code, in order to post a new piece of ticker content, I must use this code:

    tickercontent[0]='<a href="http://www.javascriptkit.com">JavaScript Kit</a><br />Comprehensive JavaScript tutorials and over 400+ free scripts!'

    If I need to surround the code with ' , then anytime I enter ' in the content itself it ends the code. This means that I can't show possession in the ticker content! E.g. If I enter "My dog's coat is shiny", the ' in dog's ends the ticker content. Am I totally missing what I need to do here? Thank you in advance for any help!

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

    Default

    Simply use a backslash (\) to escape any character inside a JavaScript string that may be interpreted differently given the context. So in this case, you'd use it like in the following:

    Code:
    tickercontent[0]='I\'m the king of the world you\'re right!'
    DD Admin

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
  •