javascript embedded within PHP array

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • brianshields@gmail.com

    javascript embedded within PHP array

    Hi, can anyone suggest how to fix this problem:

    array("<a
    href='javascrip t:popImage('med ia/images/schaf2_big.jpg' ,'')'><img
    src='media/images/".$spage."_1.gi f'></a>","rest of array..."),

    As you can see I have a PHP array and inside that I want to set a
    javascript popup but the syntax for javascript will not allow it. When
    you roll over this in the browser, the link will only show:

    "javascript:pop Image"

    It peters out on the (

    so I think - i can use ascii characters (&#40;) to complete the
    javascript function - but this isnt working either...

    Soo - is there another event handler that is better to use? Can anybody
    suggest any workaround at all?

    I would appreciate your time. Thanks!

    Brian

  • brianshields@gmail.com

    #2
    Re: javascript embedded within PHP array

    ahh - i found the \ escape - this is the fix:

    array(\"<a
    href='javascrip t:popImage('med ia/images/schaf2_big.jpg' ,\'')'><img
    src='media/images/".$spage."_1.gi f'></a>","rest of array..."),

    For other newbs like me :)

    Comment

    • Stijn Verholen

      #3
      Re: javascript embedded within PHP array

      brianshields@gm ail.com wrote:[color=blue]
      > Hi, can anyone suggest how to fix this problem:
      >
      > array("<a
      > href='javascrip t:popImage('med ia/images/schaf2_big.jpg' ,'')'><img
      > src='media/images/".$spage."_1.gi f'></a>","rest of array..."),
      >
      > It peters out on the ([/color]

      If you copy/pasted that code, the it peters out on the quotes. Use an
      editor that support php highlighting.


      Stijn

      Comment

      Working...