joeri Posted February 20, 2007 Share Posted February 20, 2007 Hi all, I'm working in PHP and I have some problems with placing javascript in it. I have the following line in HTML: <INPUT TYPE="text" value="Search for model.." size="16" NAME="model" onFocus="this.value=''" onBlur="if(this.value==''){this.value='Search for model..';}" onKeyPress="onEnter();" > That works well, but now that I want to make the same in PHP, I have this: echo"<INPUT TYPE='text' value='Search for model..' size='16' NAME='model' onFocus='this.value='' onBlur='if(this.value==''){this.value='Search for model..';}' onKeyPress='onEnter();'>"; This doesn't work, who can tell me what goes wrong? Thanks in advance, Joeri Link to comment https://forums.phpfreaks.com/topic/39318-solved-javascript-in-php/ Share on other sites More sharing options...
ballhogjoni Posted February 20, 2007 Share Posted February 20, 2007 you have to put a \ before all " ie... echo"<INPUT TYPE=\"text\" value=\"Search for model..\" size=\"16\" ...> Link to comment https://forums.phpfreaks.com/topic/39318-solved-javascript-in-php/#findComment-189575 Share on other sites More sharing options...
joeri Posted February 20, 2007 Author Share Posted February 20, 2007 Thanks!!! Link to comment https://forums.phpfreaks.com/topic/39318-solved-javascript-in-php/#findComment-189578 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.