Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #30958 > unrolled thread
| Started by | bit-naughty@hotmail.com |
|---|---|
| First post | 2016-07-22 06:51 -0700 |
| Last post | 2016-07-22 16:28 +0100 |
| Articles | 3 — 3 participants |
Back to article view | Back to comp.lang.javascript
Page refresh on click compulsory? bit-naughty@hotmail.com - 2016-07-22 06:51 -0700
Re: Page refresh on click compulsory? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-07-22 16:42 +0200
Re: Page refresh on click compulsory? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-07-22 16:28 +0100
| From | bit-naughty@hotmail.com |
|---|---|
| Date | 2016-07-22 06:51 -0700 |
| Subject | Page refresh on click compulsory? |
| Message-ID | <6b57de12-0b7b-4d3c-b674-47909c16c2ce@googlegroups.com> |
If I click on something, does it ALWAYS mean that the page will blank, and the next page will be got? How is this prevented exactly? If I just do a "addEventListener" with a "click" argument, will it be prevented? (say I just want some type of "box" to popup when a particular link is clicked, as I've seen on many sites....) I'm still new to this stuff, so learning.... :) Thanks.
[toc] | [next] | [standalone]
| From | "Evertjan." <exxjxw.hannivoort@inter.nl.net> |
|---|---|
| Date | 2016-07-22 16:42 +0200 |
| Message-ID | <XnsA64DAA04DAE36eejj99@194.109.6.166> |
| In reply to | #30958 |
bit-naughty@hotmail.com wrote on 22 Jul 2016 in comp.lang.javascript: > If I click on something, does it ALWAYS mean that the page will blank, > and the next page will be got? No. > How is this prevented exactly? If I just It is not true. It does it ALWAYS mean that. > do a "addEventListener" with a "click" argument, will it be prevented? Why not start with easier to understand: onclick = '....'; [see below] > (say I just want some type of "box" to popup when a particular link is > clicked, as I've seen on many sites....) I don't understand your "just", because it does it ALWAYS mean that. > I'm still new to this stuff, so learning.... :) Do you think that learning is 'just' for beginners? ============================ Answer, [although it is all over the web]: Have your code return *false*: <myElement onclick = 'myFunction1();myF2();return false;'> ... -- Evertjan. The Netherlands. (Please change the x'es to dots in my emailaddress)
[toc] | [prev] | [next] | [standalone]
| From | Ben Bacarisse <ben.usenet@bsb.me.uk> |
|---|---|
| Date | 2016-07-22 16:28 +0100 |
| Message-ID | <87twfhadz9.fsf@bsb.me.uk> |
| In reply to | #30958 |
bit-naughty@hotmail.com writes: > If I click on something, does it ALWAYS mean that the page will blank, > and the next page will be got? How is this prevented exactly? If I > just do a "addEventListener" with a "click" argument, will it be > prevented? If you install the event handler using addEventListener, you have to cancel the event's default behaviour by calling event.preventDefault() in the handler function. There's also the possibility that you don't want the event to propagate further up (or down) which you would do with event.stopPropagation(). <snip> -- Ben.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.javascript
csiph-web