Quote Issue, I think....

A

amerar

Hi All,

I cannot get this stupid Javascript code to embed properly in my PHP.
It does not show the 'select' button. I believe it is my quotes,
maybe Javascript does not like something.......

Anyhow, can someone help me with the syntax?? I'd really appreciate
it. The code works fine in just plain HTML......

echo "<TABLE><TR>\n";
echo " <TD><input type=text name='partydate' size=10 maxlength=10
value='$party_date'>\n";
echo " <script language='javascript'>\n";
echo " <!-- if (!document.layers) {\n";
echo " document.write(\"<input type=button
onclick='popUpCalendar(this, editparty.partydate, \"mm/dd/yyyy\")'
value='select' style='font-size:11px'>\") }\n";
echo " //-->\n";
echo " </script><BR><CENTER><span class=body><B>Party Date</
CENTER>\n";
echo " </TD>\n";
echo "</TABLE>\n";
 
S

Stevo

Anyhow, can someone help me with the syntax?? I'd really appreciate
it. The code works fine in just plain HTML......

I'd try using Fiddler (www.fiddlertool.com) or Charles (xk72.com) and
look at the html/js that you're actually generating. I bet when you see
it, the problem will be obvious.
 
T

Tim Streater

Hi All,

I cannot get this stupid Javascript code to embed properly in my PHP.
It does not show the 'select' button. I believe it is my quotes,
maybe Javascript does not like something.......

Anyhow, can someone help me with the syntax?? I'd really appreciate
it. The code works fine in just plain HTML......

echo "<TABLE><TR>\n";
echo " <TD><input type=text name='partydate' size=10 maxlength=10
value='$party_date'>\n";
echo " <script language='javascript'>\n";
echo " <!-- if (!document.layers) {\n";

Not sure what the <!-- stuff is for, I never use that.
echo " document.write(\"<input type=button

OK, an escaped double-quote for the document.write ...
onclick='popUpCalendar(this, editparty.partydate, \"mm/dd/yyyy\")'

Haven't you got nested double-quotes here, perhaps you have to escape
them twice?
value='select' style='font-size:11px'>\") }\n";
echo " //-->\n";
echo " </script><BR><CENTER><span class=body><B>Party Date</
CENTER>\n";

Missing a said:
echo " </TD>\n";
echo "</TABLE>\n";

Also missing a </tr>.

Why are you embedding the js in PHP anyway?
 
T

Thomas 'PointedEars' Lahn

Thomas said:
<input name="partydate" size="10" maxlength="10" value="<?php
echo htmlencode($party_date);
?>">

<input name="partydate" size="10" maxlength="10" value="<?php
echo htmlentities($party_date);
?>">
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top