Function in java script HELP

Javascript coding ..

Moderators: egami, macek, gesf

Post Reply
New php-forum User
New php-forum User
Posts: 51
Joined: Wed Jan 25, 2006 6:24 pm
Location: Philippines,Davao City

Wed Nov 29, 2006 2:34 am

Good Day!

I have problem encounter in the function in the java script. Can any one help me?

function Click_post(test)
code here

i used the function
$description ="hello world";

echo"<a href="#" onclick=\"showPreview('$description');\"> submit </a>";

---- This Code is OK

but if the Value of the description is

$description ="hello world Fredo's"; // or any HTML characters tag like <tables> etc.
// I have also tried to used htmlspecialchars,html_entity_decode,stripslashes, add slashes.. but still the same

it will got an error unterminated string because of this '

There a way that java script will convert this HTML characters?

thanks and God Bless
Xtian Cuan

New php-forum User
New php-forum User
Posts: 90
Joined: Fri Dec 02, 2005 3:23 am

Tue Feb 13, 2007 6:05 am

try out with this.

Code: Select all

echo"<a href="#" onclick=\"showPreview(".$description.");\"> submit </a>"; 

Post Reply