Page 1 of 1

problem putting javascript in php...

Posted: Thu Jun 09, 2005 5:32 am
by lidds
I have a problem with putting some javascript in php, probably not getting the quotes in the right place etc. could someone please help.

Below is an example of the code as normal HTML:

Code: Select all

<input name=&quote;btnReset&quote; type=&quote;reset&quote; id=&quote;btnReset&quote; value=&quote; Reset &quote; class=&quote;buttonNormal&quote; onmousedown=&quote;{this.className='buttonSelected';}&quote; onmouseover=&quote;{this.className='buttonOver';}&quote; onmouseout=&quote;{this.className='buttonNormal';}&quote;>
but what I want to be able to do is put this within a php variable example shown below (this is the code I can't get to work):

Code: Select all

$body.= &quote;<input type='button' name='btnBack' value=' Back ' class='buttonNormal' onclick='history.back();' class='buttonNormal' onmousedown='{this.className='buttonSelected';}' onmouseover='{this.className='buttonOver';}' onmouseout='{this.className='buttonNormal';}'>&quote;;
Simon

Posted: Thu Jun 09, 2005 5:41 am
by harrison
replace

Code: Select all

onmousedown='{this.className='buttonSelected';}'
with this one

Code: Select all

onmousedown=\&quote;{this.className='buttonSelected';}\&quote;
do also to the rest

Posted: Thu Jun 09, 2005 5:47 am
by lidds
thanks Harrison, worked like a charm.

Simon