By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,321 Members | 1,875 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,321 IT Pros & Developers. It's quick & easy.

quotations problem with echo("") command

P: n/a
Running php4.3.6
What i'm trying to do is exactly like the weather channell site when
you click in the zip code box the text dissapears and you are free to
type your zip.
I can make it work by using this command:
onfocus="this.value=''"
but i want to generate the string with php by using the echo("write
something here"); command.
Obviously the problem here is the double_quotes i need are screwing up
the command.Have tried using special characters and adding slashes.
which both work to a degree. The page doesn't bomb but the onfocus
still doesn't function. wtf how do i make it work??
time is 6:31pm Central
Jul 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
brianj wrote:
The page doesn't bomb but the onfocus
still doesn't function. wtf how do i make it work??


Disclaimer: I don't know JavaScript.
Maybe you get more comprehensive answers in a JavaScript newsgroup.

<?php

echo 'onfocus="this.value=\'write something here\'"';

echo "onfocus=\"this.value='write something here'\"";

$double_quote = '"';
$single_quote = "'";
echo 'onfocus=', $double_quote, 'this.value=', $single_quote,
'write something here', $single_quote, $double_quote;

?>

--
Mail sent to my "From:" address is publicly readable at http://www.dodgeit.com/
== ** ## !! !! ## ** ==
TEXT-ONLY mail to the complete "Reply-To:" address ("My Name" <my@address>) may
bypass the spam filter. I will answer all pertinent mails from a valid address.
Jul 17 '05 #2

P: n/a
>
<?php

Hey thanks a lot man this one here worked.
echo "onfocus=\"this.value='write something here'\""; I thought I tried that but apparently not.
Mucho Gracias

?>

Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.