...

View Full Version : PHP Forum - onMouseOver



Goat Spirit
12-06-2006, 08:19 PM
I am not sure wether this falls into JavaScript or PHP, probably PHP.
Alright well here is what I got right now:


{$this->table}
<tr>
<td>{$this->lang->topic_pages}:
{$pagelinks}
</td>
<td align='right'>
{$replylink}
<a href='{$this->self}?a=post&amp;s=topic&amp;f={$topic['topic_forum']}'><img src='./skins/{$this->skin}/images/newtopic.gif' alt='{$this->lang->topic_create_topic}' /></a>
<a href='{$this->self}?a=post&amp;s=poll&amp;f={$topic['topic_forum']}'><img src='./skins/{$this->skin}/images/newpoll.gif' alt='{$this->lang->topic_create_poll}' /></a>
</td>
</tr>
{$this->etable}

I need a onMouseOver and onMouseOut effect that will switch between alternate images. Anyone know what I might do?

Tyree
12-06-2006, 08:22 PM
Definitely a javascript question. PHP isn't going to change anything unless the page refreshes so the server can reprocess the code. If you want dynamic client-side changes, you have to use a client-side language.

There are many ways to do what you're asking about with javascript. Unfortunately, I don't know javascript very well! I just use the script that Dreamweaver uses! :)

Goat Spirit
12-06-2006, 08:24 PM
Alright well in JavaScript I think you have to make an array and use onMouseOver and stuff. Anyone correct me or show me an example how to do this?

ShimmyShine
12-06-2006, 09:05 PM
Ok here is what you need.. allright.


<SCRIPT LANGUAGE="JAVASCRIPT">
<!--

function roll(img_name1, img_src1, img_name2, img_src2)
{
document[img_name1].src = img_src1;
document[img_name2].src = img_src2;
}

//-->
</SCRIPT>

<A HREF="LINK TO W/E HERE!"
onmouseover="roll('sub1', 'FIRST IMAGE NAME', 'sub1', 'SECOND IMAGE NAME')">
<IMG SRC="FIRST IMAGE NAME" NAME="sub1" WIDTH="WIDTH"
HEIGHT="HEIGHT" BORDER="0">
</A>

Basically make sure where it says FIST IMAGE NAME, that it sthe same image name for each of those, and then for the rollover image, make that in the SECOND IMAGE NAME position. And the LINK TO W/E HERE! should be where they are going once they click on the image. Also, don't forget ot change the HEIGHT and WIDTH.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum