Re: PHP and Javascript escape character problem, --> those who like to solve things can try to solve this issue, its tricky I think ;)

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

 



Hey,
You can do it this way as well
$myFeedHTML .=  "<TH ROWSPAN=3 BGCOLOR='#99CCFF'> $feedItemImagePath <br />
<br /> <input type='Button' value='Edit' width='100px'
onClik=\"javascript:
>
> DeleteChannelAndAllOfItsFeeds()\" /> <br /> <br
> />DELETE<br /></TH>";


So you can escape double quotes by \ (slash)
try this .. It will work...
you can escape any special character that you want to use as it is by
prepend it by \

On Mon, Nov 2, 2009 at 2:23 PM, acetrader <salibaray@xxxxxxxxx> wrote:

>
> Hi there,
>
> I am doing an application that allows me to create RSS channels and put
> feeds inside of each channel. Everything works so far, but - now I have
> started to do the 'Edit Channel', 'Edit Feed', 'Delete Channel' and 'Delete
> Feed' functionalities and have run into a problem. For me its a big problem
> cause Im not a guru programmer but for you out there it may be a piece of
> cake.
>
> I have the following line of code:
>
> $myFeedHTML .=  "<TH ROWSPAN=3 BGCOLOR='#99CCFF'> $feedItemImagePath <br />
> <br /> <input type='Button' value='Edit' width='100px'
> onClik='javascript:DeleteChannelAndAllOfItsFeeds()' /> <br /> <br
> />DELETE<br /></TH>";
>
> In $myFeedHTML I'am always appending new HTML data to it, in this case I'am
> appending a table row/header row that has an image in it and underneath the
> image it has two buttons, one is for the EDIT functionality and the other
> is
> for the DELETE functionality.
>
> Now... notice the onClik events ->
> onClik='javascript:DeleteChannelAndAllOfItsFeeds()'    . I ususally use
> that
> method to call a javascript function from within a button or a link....and
> like this is works (on its own - ie when its not being appended as a normal
> string to the variable $myFeedHTML).
>
> But...When it is appended to a variable so that I echo everything at once
> in
> the end, the onClik action must be included inside a " (double quotes) and
> inside  ' (single quotes) so that it can be appeneded to the string, now
> when this is being done everything gets mixed because of of all the " and '
> thus the program thinks that these are normal escape characters and just
> skips over the javascript call function that is nested within the onClik
> event. So the onClik is not getting a function assigned to it. (you can see
> this in the code I've pasted above)
>
> What can I do in order to append it to my $myFeedHTML variable and at the
> same time have it assigend a javascript function inside of its EDIT/DELETE
> button onClik event ?
>
> Can you give me some example maybe etc ?
>
> Image Preview:
>
> http://old.nabble.com/file/p26156627/my%2BEscape%2BProblem.jpg
>
> btw: I know I've written onClik wrong but I wrote it this way in this forum
> cause it wouldn't let me post my thread because it regards it as an illegal
> tag lol. B-)B-)
>
> Thank you very much :) ,
> The Ace
>
>
> --
> View this message in context:
> http://old.nabble.com/PHP-and-Javascript-escape-character-problem%2C---%3E-those-who-like-to-solve-things-can-try-to-solve-this-issue%2C-its-tricky-I-think--%29-tp26156627p26156627.html
> Sent from the PHP - General mailing list archive at Nabble.com.
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Devendra Jadhav

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux