Re: php javascript problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In message <eeadcf600703311312o6e735198u38100e92226f49fb@xxxxxxxxxxxxxx>
, Farhan khalid <farhan2kf@xxxxxxxxx> writes
>Hi,
>
><script>
>function view(text)
>{
>document.getElementById("textbox").innerHTML="<input type='textbox'
>value='"+text+"'>";
>}
></script>
><a href="#" onclick="view('a \' \&quot;')">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

Where do you get the PHP from in the subject?

When I came across this issue, I found that the issue was in passing the
data to the Javascript function.  I "cheated", I put a caret (^) in the
HTML, and converted it back in the first line of the Javascript
function.  I also had a problem with "greater than" and "less than", and
did the same using { and }. 

-- 
Pete Clark

Sunny Andalucia
http://www.hotcosta.com/comm_1.htm

[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux