Skip to main content
Inspiring
November 6, 2008
Question

MouseOver Problem

  • November 6, 2008
  • 5 replies
  • 468 views
I have a set of links, that have a mouseOver added to:

<a href="search_by_location.php?rest_city=<?php echo "$row_jobs_locations[city_name]"; ?>" onMouseOver="<?php echo trim(preg_replace('#[^\p{L}\p{N}]+#u', '', $row_jobs_locations['city_name'])); ?>()" onMouseOut="mouseOut()"><?php echo $row_jobs_locations['city_name']; ?> </a>

On mouseOver it loads the image that I need it to display for a DIV named "map"

The function for this is stored in "js/map.js":
function Aberdeen()
{
document.map.src ="images/Aberdeen.jpg";
}
function AyreKilmarnockIrvine()
{
document.map.src ="images/AyreKilmarnockIrvine.jpg";
}
function BarnsleyDoncasterRotherham()
{
document.map.src ="images/BarnsleyDoncasterRotherham.jpg";
}
function BasingstokeFleet()
{
document.map.src ="images/BasingstokeFleet.jpg";
}
function Bath()
{
document.map.src ="images/Bath.jpg";
}

Now when I text this on my local machine the images change. But on my server when I rollover the hyperlink it stays on the default image.

View site: site site

Also using the W3C html validator I get errors from my javascript for <a></a> tags saying they are open or not closed.

But the tags are like this: '<a href="index.php">sumthing</a>'
This topic is closed to new replies. Start a new post to keep the conversation going.

5 replies

Participating Frequently
November 7, 2008
Not me. I find it hard enough to read my own regex.
Inspiring
November 7, 2008
I have changed it to this:

<a href="search_by_location.php?rest_city=<?php echo "$row_jobs_locations[city_name]"; ?>" onMouseOver="<?php echo trim(preg_replace('#[^\p{L}\p{N}a-zA-Z0-9]+#u', '', $row_jobs_locations['city_name'])); ?>()" onMouseOut="mouseOut()"><?php echo $row_jobs_locations['city_name']; ?> </a>

Can anyone explain why the server didnt accept the what I had coded it already.
Participating Frequently
November 7, 2008
It seems to be this line of PHP which is failing

<?php echo trim(preg_replace('#[^\p{L}\p{N}]+#u', '', $row_jobs_locations['city_name'])); ?>

It's not obvious what you're trying to do and I don't have time to play with your regex (sorry). Try using this site

http://www.switchplane.com/utilities/preg_match_regular_expression_tester.php

and/or display all errors and warnings on the testing server.
Inspiring
November 6, 2008
Your mouseovers are being written to the page as blanks -

<td><div class="smallTextCount"><a
href="search_by_location.php?rest_city=Bromley & Bexley" onMouseOver="()"
onMouseOut="mouseOut()">Bromley & Bexley </a>(0)</div></td>
</tr><tr>

Check your PHP markup.

--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
==================


"The_FedEx_Guy" <webforumsuser@macromedia.com> wrote in message
news:gev7rr$14p$1@forums.macromedia.com...
>I have a set of links, that have a mouseOver added to:
>
> <a href="search_by_location.php?rest_city=<?php echo
> "$row_jobs_locations[city_name]"; ?>" onMouseOver="<?php echo
> trim(preg_replace('#[^\p{L}\p{N}]+#u', '',
> $row_jobs_locations['city_name']));
> ?>()" onMouseOut="mouseOut()"><?php echo $row_jobs_locations['city_name'];
> ?>
> </a>
>
> On mouseOver it loads the image that I need it to display for a DIV named
> "map"
>
> The function for this is stored in "js/map.js":
> function Aberdeen()
> {
> document.map.src ="images/Aberdeen.jpg";
> }
> function AyreKilmarnockIrvine()
> {
> document.map.src ="images/AyreKilmarnockIrvine.jpg";
> }
> function BarnsleyDoncasterRotherham()
> {
> document.map.src ="images/BarnsleyDoncasterRotherham.jpg";
> }
> function BasingstokeFleet()
> {
> document.map.src ="images/BasingstokeFleet.jpg";
> }
> function Bath()
> {
> document.map.src ="images/Bath.jpg";
> }
>
> Now when I text this on my local machine the images change. But on my
> server
> when I rollover the hyperlink it stays on the default image.
>
> View site: site http://www.joyruljobs.com
>
> Also using the W3C html validator I get errors from my javascript for
> <a></a>
> tags saying they are open or not closed.
>
> But the tags are like this: '<a href="index.php">sumthing</a>'
>

Inspiring
November 7, 2008
Then how does it work on my local machine then?