|
Posted by Kimmo Laine on 06/29/05 08:41
"Hilarion" <m0rt_nospam_@nospam_bez_spamu_itepe_poczta.onet.pl> wrote in
message news:d9se53$msr$1@news.onet.pl...
> Domestos wrote:
>> Cruddy code examples on the net... ported into my program and don't
>> work...
>> any idea's?
>>
>> echo '<a href="javascript: void(0)"
>> onClick="window.open("club_info.php?clubcode="'.$code.'","mypage","width=300
>> ,height=300,toolbar=0,resizable=0,scrollable=1");"><img src="'.$badge.'"
>> width="50" height="50" border="0" ALT="'.$name.'">'</a>';
>
> It almost works (just remove the "'" sign before "</a>").
> The problem is that this PHP code generates invalid HTML.
> The solution is:
> 1. Look at the HTML code it generates.
> 2. Fix the HTML code.
> 3. Copy and paste the correct HTML code into your PHP code.
>
Yes, the php will work correctly once the extra ' is removed. Still the
javascript is incorrect. To fix the javascript, OP should convert some
double qoutes that are broken to single qoutes and adjust the mis-placed
comma. Here's what the code generates:
<a href="javascript: void(0)"
onClick="window.open("club_info.php?clubcode="",mypage,width=300
,height=300,toolbar=0,resizable=0,scrollable=1");"><img src=""
width="50" height="50" border="0" ALT=""></a>
The thing is, double qoutes inside double quotes is sexual harrasment, and
that makes me a saaaaad panda. What it _should_ generate:
<a href="javascript: void(0)"
onClick="window.open('club_info.php?clubcode=','mypage,width=300
,height=300,toolbar=0,resizable=0,scrollable=1');"><img src=""
width="50" height="50" border="0" ALT=""></a>
Long story short: here's a code that should work (I tested and it did work)
echo "<a href='javascript: void(0)'
onClick=\"window.open('club_info.php?clubcode=$code', 'mypage',
'width=300, height=300,toolbar=0,resizable=0,scrollable=1');\">
<img src='$badge' width='50' height='50' border='0' ALT='$name'></a>";
--
"I am pro death penalty. That way people learn
their lesson for the next time." -- Britney Spears
eternal.erectionN0@5P4Mgmail.com
Navigation:
[Reply to this message]
|