PDA

View Full Version : problem when clicking a rollover button


carocgm
07-26-2012, 07:40 PM
Hi everyone, I'm using Dreamweaver to design a basic site, and I've come across a problem:

I have a jpg which is a button, to which I've assigned two behaviors for onmouseover:

1. swap image, which replaces the image with a different jpg (for a basic rollover effect)
2. show/hides elements, to display/hide layers in order to show the information corresponding to that section of the page.

The problem is that once the site's uploaded and someone goes ahead and clicks on the link, they will get an error page - file not found (only because they're not supposed to click it in the first place, the content's already changed when they hover over the button! But some people still do, and I don't particularly like what happens then).

So I'm wondering how can I tell the button to just leave everything as it is at the onclick event? I've tried assigning a different behavior, but to no avail.

I know next to nothing about code, so please bear that in mind when answering, but I would really appreciate some help here.

The same thing happens with several other buttons like the one I described, and also with buttons which are plain text written directly on DW. I really want the action to happen on the onmouseover event, and not change it to onclick, which I suspect would solve the problem altogether.

Thanks in advance for your time and please ask if something wasn't clear. I can include the code DW so kindly generated for me, if that helps.

Carolina

carocgm
07-26-2012, 07:49 PM
no, still haven't solved it

carocgm
07-26-2012, 08:09 PM
onclick="return false;"


that did the trick:)

Corrosive
07-27-2012, 07:16 AM
onclick="return false;"


that did the trick:)

Nice one. A 'null' link <a href="#"></a> may also have worked.

domedia
07-27-2012, 02:22 PM
Nice one. A 'null' link <a href="#"></a> may also have worked.

Right, but what are we marking up here? If it's not a link, we should not use the A tag.

domedia
07-27-2012, 02:23 PM
So if you just use a regular element, a P for example, you don't need to worry about people clicking it.