This is a discussion on 'onmouseover' javascript in .php echo command, is proving troublesome? within the alt.comp.lang.php forums, part of the PHP Programming Forums category; Hi, Can anyone please tell me what is wrong with this code ? I have a 2d Array defined in an ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hi,
Can anyone please tell me what is wrong with this code ? I have a 2d Array defined in an included PHP file as follows :- /Site #1 $sitename[0][0]="The Site Name"; $bannerlocation[0][0]="banners/468x60_2126.gif"; $bannerdescrition[0][0]="Visit my site!"; $sitelink[0][0]=http://www.mysite.com; In my main PHP file, I have the following line echo "<center><a href='".$sitelink[$bantype][$bancode]."' onmouseover='status=\"Visit .$sitename[$bantype][$bancode]. \"'; return true' onmouseout='status=\" \"; return true' target='".$sitename[$bantype][$bancode]."'><img src='".$bannerlocation[$bantype][$bancode]."' border='0' alt='".$bannerdescription[$bantype][$bancode]."'></a></center><br>"; This displays the graphic accordingly, and the link also works. HOWEVER, when placing the mouse over the banner, instead of saying "Visit The Site Name", it says the href link on the status bar instead, as if the 'onmouseover' javascript never existed ? Any help much appreciated. Thanks, Mark |
|
|||
|
Mark wrote:
> Hi, > > Can anyone please tell me what is wrong with this code ? > > I have a 2d Array defined in an included PHP file as follows :- > > /Site #1 > $sitename[0][0]="The Site Name"; > $bannerlocation[0][0]="banners/468x60_2126.gif"; > $bannerdescrition[0][0]="Visit my site!"; > $sitelink[0][0]=http://www.mysite.com; > > > In my main PHP file, I have the following line > > echo "<center><a href='".$sitelink[$bantype][$bancode]."' > onmouseover='status=\"Visit .$sitename[$bantype][$bancode]. \"'; return > true' onmouseout='status=\" \"; return true' > target='".$sitename[$bantype][$bancode]."'><img > src='".$bannerlocation[$bantype][$bancode]."' border='0' > alt='".$bannerdescription[$bantype][$bancode]."'></a></center><br>"; > > > This displays the graphic accordingly, and the link also works. HOWEVER, > when placing the mouse over the banner, instead of saying "Visit The Site > Name", it says the href link on the status bar instead, as if the > 'onmouseover' javascript never existed ? > > > Any help much appreciated. > > > Thanks, Mark > > You're missing some quotes ... Did you look at the resulting source ? It would have showed you the problem Try this: echo '<center><a href="' . $sitelink[$bantype][$bancode]. '" onmouseover="status=\'Visit ' . $sitename[$bantype][$bancode]. '\'; return true;" onmouseout="status=\' \'; return true;" target="' .. $sitename[$bantype][$bancode] . '"><img src="' .. $bannerlocation[$bantype][$bancode] . '" border="0" alt="' .. $bannerdescription[$bantype][$bancode] . '"></a></center><br>'; |
|
|||
|
I would not break the line at "return true". Also use onmouseover=" .... "
This works: echo "<center><a href='".$sitelink[$bantype][$bancode]."' onmouseover=\"status='Visit ".$sitename[$bantype][$bancode]." '; return true\" onmouseout='status=\" \"; return true' target='".$sitename[$bantype][$bancode]."'><img src='".$bannerlocation[$bantype][$bancode]."' border='0' alt='".$bannerdescription[$bantype][$bancode]."'></a></center><br>"; HTH. "Mark" <mark_news@horsemad.co.uk> wrote in message news:9yfed.254$qj2.253@newsfe6-win.ntli.net... > Hi, > > Can anyone please tell me what is wrong with this code ? > > I have a 2d Array defined in an included PHP file as follows :- > > /Site #1 > $sitename[0][0]="The Site Name"; > $bannerlocation[0][0]="banners/468x60_2126.gif"; > $bannerdescrition[0][0]="Visit my site!"; > $sitelink[0][0]=http://www.mysite.com; > > > In my main PHP file, I have the following line > > echo "<center><a href='".$sitelink[$bantype][$bancode]."' > onmouseover='status=\"Visit .$sitename[$bantype][$bancode]. \"'; return > true' onmouseout='status=\" \"; return true' > target='".$sitename[$bantype][$bancode]."'><img > src='".$bannerlocation[$bantype][$bancode]."' border='0' > alt='".$bannerdescription[$bantype][$bancode]."'></a></center><br>"; > > > This displays the graphic accordingly, and the link also works. HOWEVER, > when placing the mouse over the banner, instead of saying "Visit The Site > Name", it says the href link on the status bar instead, as if the > 'onmouseover' javascript never existed ? > > > Any help much appreciated. > > > Thanks, Mark > > |
![]() |
| Thread Tools | |
| Display Modes | |
|
|