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 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Jan 2005
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    URLs with onClick events into an Array?

    Hi, thanks for taking the time to read my post.

    As mentioned in the subject, my problem is that i am trying to enter URLs with onClick events into an array.

    Here is the relevant part of the code, document.FrontCP.font is a hidden form field:

    linkset[0]='<div><a href="#" onclick="document.FrontCP.font.value='arial'">arial</a></div>'
    linkset[0]+='<div><a href="#" onclick="document.FrontCP.font.value='verdana'">verdana</a></div>'
    etc....

    The problem is that with the field's value needing surrounding apostrophes, only the first part of the string, "<div><a href="#" onclick="document.FrontCP.font.value=" goes into the array. I have no idea where to go from here, so any help would be appreciated.

  • #2
    New Coder
    Join Date
    Jan 2005
    Location
    Atlanta
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You have to escape the single quotes around the value:

    linkset[0]='<div><a href="#" onclick="document.FrontCP.font.value=\'arial\'">arial</a></div>'
    linkset[0]+='<div><a href="#" onclick="document.FrontCP.font.value=\'verdana\'">verdana</a></div>'
    etc....

  • #3
    New to the CF scene
    Join Date
    Jan 2005
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks for the quick reply, works great now


  •  

    Posting Permissions

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