Function in java script HELP

Javascript coding ..

Moderators: macek, egami, gesf

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

Function in java script HELP

Postby trestian » 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

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

Postby sanketce » Tue Feb 13, 2007 6:05 am

try out with this.

Code: Select all

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

Return to “JavaScript”

Who is online

Users browsing this forum: No registered users and 0 guests