dava133
|
| Posted: 10/01/2002, 5:37 PM |
|
I have a menu and I would like to display different text than the url when the mouse goes over the image buttons.
I am using a field with type url and caption <img src="images/listneningpost_uk.jpg" border="0" width="154" height="126">
using dreamweaver I see that to do what I want the html is as follows:
<a href="javascript:;" onMouseOver="MM_displayStatusMsg('The Listening Post');return document.MM_returnValue"><img src="listneningpost_uk.jpg" width="154" height="126" border="0"></a>
Where do I put the extra bit of code?? cheers
|
|
|
 |
jgmoreira
|
| Posted: 10/02/2002, 4:07 AM |
|
Hello dava13,
I'm not particularly good with Dreamweaver but loooking for the output code you gave I can see it shows " <a href="javascript:;" onMouseOver="MM_displayStatusMsg('The Listening Post');return document.MM_returnValue"><img src="listneningpost_uk.jpg" width="154" height="126" border="0"></a> ". What I can see is that there is a problem with the link (anchor) to the JavaScript: "<a href="javascript:;..." because the javascript is not defined.
If you want you can try this script:
1. Put this script between the HEAD tags of the page and replace each "images/botao#_*.gif" with your own images :
<SCRIPT LANGUAGE="JavaScript">
<!--
{
navbar1on = new Image();
navbar1on.src = "images/botao1_home_on.gif";
navbar1off = new Image();
navbar1off.src = "images/botao1_home_off.gif";
navbar2on = new Image();
navbar2on.src = "images/botao2_home_on.gif";
navbar2off = new Image();
navbar2off.src = "images/botao2_home_off.gif";
navbar3on = new Image();
navbar3on.src = "images/botao3_home_on.gif";
navbar3off = new Image();
navbar3off.src = "images/botao3_home_off.gif";
navbar4on = new Image();
navbar4on.src = "images/botao4_home_on.gif";
navbar4off = new Image();
navbar4off.src = "images/botao4_home_off.gif";
navbar5on = new Image();
navbar5on.src = "images/botao5_home_on.gif";
navbar5off = new Image();
navbar5off.src = "images/botao5_home_off.gif";
}
function img_act(imgName) {
imgOn = eval(imgName + "on.src");
document [imgName].src = imgOn;
}
function img_inact(imgName) {
imgOff = eval(imgName + "off.src");
document [imgName].src = imgOff;
}
function img_act_varios(imgName, imgOn) {
document [imgName].src = eval(imgOn + "on.src");
}
//-->
</SCRIPT>
2. If you want to hear a beep OnMouseOver too, you should add this between the HEAD tags (I suggest you put it one line below the script). Don't forget to copy the source sound file (http://www.unimagem.pt/audio/menu.wav)
<BGSOUND ID="beep" SRC="#" AUTOSTART="true" LOOP="1">
3. Then, between your BODY tags, in the buttons place you should put something like this for the first and in each other:
<A HREF="destination_file.html" OnMouseOver="window.status='the text you want to be displayed'; img_act('navbar1'); document.all.beep.src='audio/menu.wav'; return true" OnMouseOut="window.status=''; img_inact('navbar1'); return true"><IMG NAME="navbar1" SRC="images/botao1_home_off.gif" WIDTH="180" HEIGHT="32" BORDER="0" ALT="assessoria de imprensa"></A>
4. If you want to see an example working visit http://www.unimagem.pt. The file with the code is http://www.unimagem.pt/entrada.html.
Hope this helps. But I think we are now using this forum to discuss JavaScript functions and not its purpose (dynamic programming languages). If you need more help you can e-mail me tojgmoreira@tananet.com
|
|
|
 |
|