I have found that HREF is mandatory for onClick to work. I've always
included it, as I've never had an occasion when it matter... but now
it does.
I want to use onClick, but not have the page reload at all... just
execute my onClick function.
I've used <A HREF = # > but this reloads the page and < A HREF = "">
try to take me to the directory listing the file is in. Any ideas on
how to make onClick not reload? (like onMouseover).
...Eric
--
===============================================================================
Eric C. Chien http://www.seas.ucla.edu/~ecchien
ecc...@seas.ucla.edu University California Electrical Engineering
ecc...@ucla.edu Los Angeles Microbiology/Molecular Genetics
<a href="javascript:void(0)" onclick=FUNCTION()... (void(0)=do nothing)
or
<a href="javascript:FUNCTION()"...
the first version doesn't work with NN2, for the second solution i don't
know. both work fine with NN3
good luck,
arne
--
Videomuseum
6, rue Beaubourg
75004 Paris
Tel : (33-1) 42.71.61.39
Fax : (33-1) 42.71.62.90
e-mail : mei...@videomuseum.fr
Use HREF="javascript:void('')"
This seams to be an undocumented function in javascript
Jeroen
--
,,,
(o o)
~~~~~oOO~~(_)~~OOo~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[ Jeroen Verschuuren ]
[ ]
[ mailto:j.l.m.ve...@utct.ct.utwente.nl ]
[ http://www.ct.utwente.nl/~schuuren ]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~oOO~~( )~~OOo~~~~~~
@ @
/|||\
no, its in the NN3.0 summary of new features of the netscape autoring
guide....
or use <A HREF="javascript: function()"> without the onClick
--Cam
And of course doesn't work with MSIE, like most of these new NN3
features. The Netscape pages are actually *proud* of that! Does anyone
know what to use that will work with both NN3 and MSIE3? (I actually
hate Microsnort's guts, but when you make a site for customers...)
Thanks.
--
Michel Bardiaux
UsrConsult S.P.R.L. Rue Margot, 37 B-1457 Nil St Vincent
Tel : +32 10 65.44.15 Fax : +32 10 65.44.10
> And of course doesn't work with MSIE, like most of these new NN3
> features. The Netscape pages are actually *proud* of that! Does anyone
> know what to use that will work with both NN3 and MSIE3? (I actually
> hate Microsnort's guts, but when you make a site for customers...)
Make one yourself:
function none(){}
does the exact same thing except you don't have to send any parameters
(like the '' in void)
nhj
This is exactly what I wound up doing, except that I called it nop() .
--
Ken
Are you interested in |
byte-sized education | http://www.play-hookey.com
over the Internet? |
given the choice of a user defined function instead of the onclick
event, produces an interesting bug.
<a href="javascript:GoSomewhere('home')" onMouseOver="window.status='Go
home'">Home</A>
When I put the mouse directly over the text anchor Home my status
bar says javascript:GoSomewhere('home')
but if I put my mouse above or below the anchor my status bar
says Go home.
How odd. I wish I could make it say what I want it too.
For NN3 I do this:
<a href="" onClick='myfunc();return false'>
MSIE ignores the "return false" and shows the directory listing, so I
added this:
<a name="here">
<a href="#here" onClick='myfunc();return false'>
MSIE does reload the page, but MSIE users sure deserve this
inconvenience.
I have also added the following code at the beginning of the script, and
I recommend everyone to do something similar:
==========================================================
var MSIE = false;
uAgent = navigator.userAgent;
if (uAgent.indexOf("MSIE", 0)>=0)
MSIE = true;
if (MSIE)
alert("You are using Microsoft Internet Explorer! This site works best
with Netscape Nevigator - download it by following the link on this
page.");
===========================================================
I do this:
<a name="
>
> Thanks.
> --
> Michel Bardiaux
> UsrConsult S.P.R.L. Rue Margot, 37 B-1457 Nil St Vincent
> Tel : +32 10 65.44.15 Fax : +32 10 65.44.10
--
----
Uri Postavsky ur...@rtlsoft.com
Right to Left Software http://www.rtlsoft.com
> When I put the mouse directly over the text anchor Home my status
> bar says javascript:GoSomewhere('home')
> but if I put my mouse above or below the anchor my status bar
> says Go home.
Make the onMouseOver event return true. Then Netscape (presumably
version 3 only) will not display the anchor's href.
Works for me :-)
Paul
Two options:
HREF="#" onclick="functionfoo();return false"><!-- that previous onclick
return cancels the click - but only in N3 ...
OR
HREF="javascript:functionfoo()"><!-- works in all impl of javascript. but
clicking on the link will stop the loading of the current page :-( and
onmouseover wont work in N2 :-(
Cheers,
Brian