Connecting Tech Pros Worldwide Help | Site Map

javascript embedded within PHP array

brianshields@gmail.com
Guest
 
Posts: n/a
#1: Jul 17 '05
Hi, can anyone suggest how to fix this problem:

array("<a
href='javascript:popImage('media/images/schaf2_big.jpg','')'><img
src='media/images/".$spage."_1.gif'></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:popImage"

It peters out on the (

so I think - i can use ascii characters (() 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
Guest
 
Posts: n/a
#2: Jul 17 '05

re: javascript embedded within PHP array


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

array(\"<a
href='javascript:popImage('media/images/schaf2_big.jpg',\'')'><img
src='media/images/".$spage."_1.gif'></a>","rest of array..."),

For other newbs like me :)

Stijn Verholen
Guest
 
Posts: n/a
#3: Jul 17 '05

re: javascript embedded within PHP array


brianshields@gmail.com wrote:[color=blue]
> Hi, can anyone suggest how to fix this problem:
>
> array("<a
> href='javascript:popImage('media/images/schaf2_big.jpg','')'><img
> src='media/images/".$spage."_1.gif'></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
Closed Thread