[Javascript] RE: href vs onclick (Anthony Webster)

Senior, Henry (TWIi London) HSenior at twii.net
Wed Oct 9 04:20:45 CDT 2002


It's a good idea to use "return false" eg. onclick="functionName();return
false"
this way the browser doesn't try to go to whatever is specified in the href
when the link is clicked.
If the onclick calls a submit function then you have effectively asked the
browser to go to the href and the action of whatever form you are
submitting.

-----Original Message-----
From: javascript-request at LaTech.edu
[mailto:javascript-request at LaTech.edu]
Sent: 08 October 2002 18:01
To: javascript at LaTech.edu
Subject: Javascript digest, Vol 1 #771 - 4 msgs


Send Javascript mailing list submissions to
	javascript at LaTech.edu

To subscribe or unsubscribe via the World Wide Web, visit
	https://lists.LaTech.edu/mailman/listinfo/javascript
or, via email, send a message with subject or body 'help' to
	javascript-request at LaTech.edu

You can reach the person managing the list at
	javascript-admin at LaTech.edu

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Javascript digest..."


Today's Topics:

   1. Re: Obtain IP number (Mark.Drozd at walgreens.com)
   2. href vs onclick (Anthony Webster)
   3. Re: href vs onclick (Peter-Paul Koch)
   4. RE: href vs onclick (Anthony Webster)

--__--__--

Message: 1
Subject: Re: [Javascript] Obtain IP number
To: javascript at LaTech.edu
From: Mark.Drozd at walgreens.com
Date: Mon, 7 Oct 2002 15:11:03 -0500
Reply-To: javascript at LaTech.edu


This applet has been helpful to me in obtaining IP addresses...even when
the user is going through a Frame relay or behind a firewall. Not pure
javascript but I think you will find it works much more accurately. You
will have to make a small modification to pass the IP value back  as a form
field.

Hope this helps...


http://reglos.de/myaddress/MyAddress.html







ws <ws at chello.se>@LaTech.edu on 10/07/2002 10:16:37 AM

Please respond to javascript at LaTech.edu

Sent by:    javascript-admin at LaTech.edu


To:    javascript at LaTech.edu
cc:

Subject:    [Javascript] Obtain IP number


Is there a way of, by javascript, obtaining a user's IP number and include
it with the results of
a web form? The user enters his name, e-mail etc into the form but I'd also
like to get the IP number...

Regards,
L Johansson

_______________________________________________
Javascript mailing list
Javascript at LaTech.edu
https://lists.LaTech.edu/mailman/listinfo/javascript





--__--__--

Message: 2
Date: Tue, 8 Oct 2002 10:16:20 +0100
From: "Anthony Webster" <Anthonywebster at venda.com>
To: <javascript at LaTech.edu>
Subject: [Javascript] href vs onclick
Reply-To: javascript at LaTech.edu

hi,

I always used to call my scripts like this:
<a href=3D"#" onclick=3D"myFunction();">click here</a>

but have recently found this is causing problems with IE5

the workaround has been to do this:
<a href=3D"javascript:myFunction();">click here</a>

is this the correct way to call scripts or are both methods acceptable?

just wondering if I've been doing things wrong all this time,

thanks

anthony

--__--__--

Message: 3
From: "Peter-Paul Koch" <gassinaumasis at hotmail.com>
To: javascript at LaTech.edu
Subject: Re: [Javascript] href vs onclick
Date: Tue, 08 Oct 2002 10:29:41 +0000
Reply-To: javascript at LaTech.edu




>I always used to call my scripts like this:
><a href="#" onclick="myFunction();">click here</a>
>
>but have recently found this is causing problems with IE5

5.0 (as opposed to 5.5)?

>the workaround has been to do this:
><a href="javascript:myFunction();">click here</a>
>
>is this the correct way to call scripts or are both methods acceptable?
>
>just wondering if I've been doing things wrong all this time,

There's a bug in IE 5.0 that requires you to use <a href="javascript:etc"> 
when submitting a form through JavaScript. The onClick simply won't work. 
But I've never seen this bug creep up in other circumstances.

In any case it's solved in IE 5.5

ppk

_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com


--__--__--

Message: 4
Subject: RE: [Javascript] href vs onclick
Date: Tue, 8 Oct 2002 11:32:22 +0100
From: "Anthony Webster" <Anthonywebster at venda.com>
To: <javascript at LaTech.edu>
Reply-To: javascript at LaTech.edu

hi peter,

yes it was in 5.0 and the link was inside a form.

thanks for your help,

anthony

-----Original Message-----
From: Peter-Paul Koch [mailto:gassinaumasis at hotmail.com]
Sent: 08 October 2002 11:30
To: javascript at LaTech.edu
Subject: Re: [Javascript] href vs onclick





>I always used to call my scripts like this:
><a href=3D"#" onclick=3D"myFunction();">click here</a>
>
>but have recently found this is causing problems with IE5

5.0 (as opposed to 5.5)?

>the workaround has been to do this:
><a href=3D"javascript:myFunction();">click here</a>
>
>is this the correct way to call scripts or are both methods acceptable?
>
>just wondering if I've been doing things wrong all this time,

There's a bug in IE 5.0 that requires you to use <a =
href=3D"javascript:etc">=20
when submitting a form through JavaScript. The onClick simply won't =
work.=20
But I've never seen this bug creep up in other circumstances.

In any case it's solved in IE 5.5

ppk

_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com

_______________________________________________
Javascript mailing list
Javascript at LaTech.edu
https://lists.LaTech.edu/mailman/listinfo/javascript


--__--__--

_______________________________________________
Javascript mailing list
Javascript at LaTech.edu
https://lists.LaTech.edu/mailman/listinfo/javascript


End of Javascript Digest


DISCLAIMER - The preceding e-mail message (including any attachments)
contains information that may be confidential, may be protected by the
attorney-client or other applicable privileges, or may constitute non-public
information.  It is intended to be conveyed only to the designated
recipient(s) named above.  If you are not an intended recipient of this
message, or have otherwise received it in error, please notify the sender by
replying to this message and then delete all copies of it from your computer
system.  Any use, dissemination, distribution, or reproduction of this
message by unintended recipients is not authorized and may be unlawful. The
contents of this communication do not necessarily represent the views of
this company.



More information about the Javascript mailing list