Farhan, the problem _appears_ to be that the call to the JavaScript converts the string " into a real quote. You might want to try using your own pseudo-tag, say '[quot]', then use replace() to convert it back into proper HTML. Rob. -----Original Message----- From: php-objects@xxxxxxxxxxxxxxx [mailto:php-objects@xxxxxxxxxxxxxxx] On Behalf Of Farhan khalid Sent: 31 March 2007 21:13 To: php-objects@xxxxxxxxxxxxxxx Subject: php javascript problem Hi, <script> function view(text) { document.getElementById("textbox").innerHTML="<input type='textbox' value='"+text+"'>"; } </script> <a href="#" onclick="view('a \' \"')">click to view textbox</a> <div id="textbox"></div> this is an example of what im trying to do in a site what this code does is when you click on hyperlink it shows a textbox in the div with text but single quote is causing problem and not letting it show the textbox even though i have escaped the single quote it will still not work double quote is working fine. my guess is since i first send it to function and then function prints it so the escape i did is removed and it starts giving error and will not print textbox in the div can anyone tell what should i add to escape and make it working i tested it in textarea its working there only it causes problem in textbox Thanks Farhan *********************************************************************************** Any opinions expressed in email are those of the individual and not necessarily those of the company. This email and any files transmitted with it are confidential and solely for the use of the intended recipient or entity to who they are addressed. It may contain material protected by attorney-client privilege. If you are not the intended recipient, or a person responsible for delivering to the intended recipient, be advised that you have received this email in error and that any use is strictly prohibited. Random House Group + 44 (0) 20 7840 8400 http://www.randomhouse.co.uk http://www.booksattransworld.co.uk http://www.kidsatrandomhouse.co.uk Generic email address - enquiries@xxxxxxxxxxxxxxxxx Name & Registered Office: THE RANDOM HOUSE GROUP LIMITED 20 VAUXHALL BRIDGE ROAD LONDON SW1V 2SA Random House Group Ltd is registered in the United Kingdom with company No. 00954009, VAT number 102838980 ***********************************************************************************