STRIPSLASHES();
use single quotes for the array.
add the slashes in front each JS's single quote,
when echoing use :
echo stripslashes($js);
Sincerely,
Maxim Maletsky
Founder, Chief Developer
PHPBeginner.com (Where PHP Begins)
[EMAIL PROTECTED]
www.phpbeginner.com
-----Original Message-----
From: Marcus Ouimet [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 27, 2001 6:58 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Array & Javascript?
I am trying to add a Javascript in array but it gives me an error
unless
certain characters are commented which makes sense, but then the Javascript
won't run. Any ideas here is what I am trying:
<?
$info_box_contents = array();
$info_box_contents[] = array('align' => 'left',
'text' => '
<A HREF="test.html" onmouseover="document.images[0].src='test1'.jpg; return
true;">
<IMG SRC="images/reviews.jpg" BORDER=0></A>');
of course the ' characters are a problem etc. so for an example I tried:
<?
$info_box_contents = array();
$info_box_contents[] = array('align' => 'left',
'text' => '
<A HREF="test.html" onmouseover="document.images[0].src=\'test1\'.jpg;
return true;">
<IMG SRC="images/reviews.jpg" BORDER=0></A>');
Any suggestions on how to get this to work?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]