You have a <head> in your view? No the layout? Does the HTML source look right?

Anyway, your onHover function won't work because you're not passing
the full path to the image. Remember that HtmlHelper expectes a
relative path from webroot/img. However, you're only passing the
filename, instead of '/img/'+filename.

Also, if you're going to do your rollovers like this, you'd be better
off preloading them by creating Image objects and assigning the src to
them. eg.

var foo = new Image();
foo.src = '/img/foo.gif';
var foo_hover = new Image();
foo_hover.src = '/img/foo_hover.gif';

In reality, it'd be better t create an array of those. Pass the name
or key, plus the stat--on or off--to your function, where you swap
element.src with src of whichever Image is required.

On Sun, Aug 9, 2009 at 8:09 PM, Sarah<[email protected]> wrote:
>
> I assume you want only the relevant parts.
>
> In my view I have:
>
> <head>
>        <meta http-equiv="Content-Type" content="text/html;
> charset=ISO-8859-1">
>    <title>Animal Tlatoque</title>
>    <?php echo $javascript->link('evoicesindex'); ?>
>    <?php echo $html->css('evoices'); ?>
>  </head>
>
>
>    <div id="library" class="mapElement">
>        <?php echo $html->link($html->image('Library3Sized.gif', array
> ('alt'=>'Library', 'onmouseover'=>'onHover(this)',
> 'onmouseout'=>'onUnHover(this)')), array('controller'=>'evoices',
> 'action'=>'library'), array('escape'=>false)); ?>
>    </div>
>
> Then I use it like so (I have an onUnHover written too )in my
> evoicesindex.js which is located in webroot/js
>
> function onHover(element){
>
>    if(element.alt == "Games")
>        element.src = "images/mesogamesHover.gif";
>
>    if(element.alt == "House")
>        element.src = "images/mesohouseHover.gif";
>
>    if(element.alt == "Library")
>        element.src = "Library3Sized.gif";
>
>    if(element.alt == "Adventure Game")
>        element.src = "images/forestHover.gif";
>
>    if(element.alt == "School House")
>        element.src = "images/mesoschoolHover1.gif";
>
> }
>
> Please let me know if I should just post the whole files...
>
> Thanks for you help,
> ~S
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to