problem putting javascript in php...

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
lidds
Forum Newbie
Posts: 5
Joined: Mon Oct 20, 2003 10:22 am
Location: UK

problem putting javascript in php...

Post 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
User avatar
harrison
Forum Commoner
Posts: 30
Joined: Thu Jun 09, 2005 12:23 am

Post 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
lidds
Forum Newbie
Posts: 5
Joined: Mon Oct 20, 2003 10:22 am
Location: UK

Post by lidds »

thanks Harrison, worked like a charm.

Simon
Post Reply