From: Stefan Weiss on
On 08/05/10 02:24, M.L. wrote:
> Thanks for the additional clues, but I'm just not getting something
> right, even after quoting the argument.
>
> '<p onClick="makeTextarea('+counter+',\"'+ptext2+'\")">'
>
> Firefox Error Console: syntax error
> makeTextarea(0,

The onclick attribute is delimited by double quotes, so you can't use
those inside the attribute value. It will come out as

onClick="makeTextarea(0, "test_text")"

The second " ends the attribute value. Try this:

'<p onClick="makeTextarea(' + counter + ",'" + ptext2 + '\')">'


--
stefan
From: M.L. on


>> Thanks for the additional clues, but I'm just not getting something
>> right, even after quoting the argument.
>>
>> '<p onClick="makeTextarea('+counter+',\"'+ptext2+'\")">'
>>
>> Firefox Error Console: syntax error
>> makeTextarea(0,
>
>The onclick attribute is delimited by double quotes, so you can't use
>those inside the attribute value. It will come out as
>
> onClick="makeTextarea(0, "test_text")"
>
>The second " ends the attribute value. Try this:
>
> '<p onClick="makeTextarea(' + counter + ",'" + ptext2 + '\')">'

Thanks for your patience Stefan. To help me better understand the
quoting mix I replaced each escaped quote with its HTML entity
character &quot;. It worked!

'<p onClick="makeTextarea('+counter+',&quot;'+ptext+'&quot;)">'