SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Guru
    Join Date
    Sep 2007
    Posts
    971
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Multiple operators

    Hi below is my code. I need to add " in the onclick area instead of '. how can I add " if the code already has open ".

    PHP Code:
    $showpin "<div class='contentmboardbutton3' onClick='document.location.href = 'messageboard.php?act=pin&msgid=$msgid'';>PIN</div>"
    Animated Chatrooms - www.121chatrooms.net

  2. #2
    SitePoint Evangelist
    Join Date
    Oct 2005
    Location
    Michigan, USA
    Posts
    434
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Code:
    onClick='document.location.href = \"messageboard.php?act=pin&msgid={$msgid}\"'
    You need to escape the double quotes by using the backslash.

    Also, I put curly braces around your variable there. This isn't necessary in this example but is a good practice.
    - Robert


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
  •