Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #12087 > unrolled thread
| Started by | Bootleg Bart <jknmp@axcop.org> |
|---|---|
| First post | 2012-02-23 05:55 -0600 |
| Last post | 2012-02-23 15:55 +0100 |
| Articles | 8 — 2 participants |
Back to article view | Back to comp.lang.javascript
setTimeout and onclick Bootleg Bart <jknmp@axcop.org> - 2012-02-23 05:55 -0600
Re: setTimeout and onclick Bootleg Bart <jknmp@axcop.org> - 2012-02-23 06:57 -0600
Re: setTimeout and onclick Bootleg Bart <jknmp@axcop.org> - 2012-02-23 07:42 -0600
Re: setTimeout and onclick Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-02-23 14:58 +0100
Re: setTimeout and onclick Bootleg Bart <jknmp@axcop.org> - 2012-02-23 08:48 -0600
Re: setTimeout and onclick Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-02-23 15:59 +0100
Re: setTimeout and onclick Bootleg Bart <jknmp@axcop.org> - 2012-02-23 08:51 -0600
Re: setTimeout and onclick Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-02-23 15:55 +0100
| From | Bootleg Bart <jknmp@axcop.org> |
|---|---|
| Date | 2012-02-23 05:55 -0600 |
| Subject | setTimeout and onclick |
| Message-ID | <bq9ck7l21j5j0t5tfmiegdlevuopg8dfh9@4ax.com> |
onclick works and changes the self location in IE and Chrome. A new
window is also opened with the href="javascript:v6" in IE and Chrome.
FireFox - onclick changes the self.location but doesn't open a new
window.What am I doing wrong? Thanks.
<area coords="159, 110, 234, 127"
href="javascript:v6('securitydetails.htm','_blank','scrollbars=yes,resizable=yes,width=780,height=690,top=0,left=0')"
onclick="setTimeout(window.location.href='360v6.htm', 500)"
shape="rect" />
[toc] | [next] | [standalone]
| From | Bootleg Bart <jknmp@axcop.org> |
|---|---|
| Date | 2012-02-23 06:57 -0600 |
| Message-ID | <fmdck79555vd4hkuecpavubhomdm5d4i8u@4ax.com> |
| In reply to | #12087 |
On Thu, 23 Feb 2012 05:55:40 -0600, Bootleg Bart <jknmp@axcop.org>
wrote:
I changed the onclick to - onclick="allLinks('360v6.htm')"
function allLinks(link){
window.location.href = link;
}
And the same thing as described below. FireFox doesn't open a new
window or tab.
>onclick works and changes the self location in IE and Chrome. A new
>window is also opened with the href="javascript:v6" in IE and Chrome.
>
>FireFox - onclick changes the self.location but doesn't open a new
>window.What am I doing wrong? Thanks.
>
>
><area coords="159, 110, 234, 127"
>href="javascript:v6('securitydetails.htm','_blank','scrollbars=yes,resizable=yes,width=780,height=690,top=0,left=0')"
>onclick="setTimeout(window.location.href='360v6.htm', 500)"
>shape="rect" />
[toc] | [prev] | [next] | [standalone]
| From | Bootleg Bart <jknmp@axcop.org> |
|---|---|
| Date | 2012-02-23 07:42 -0600 |
| Message-ID | <chgck71iesk91n8phebsimcil0d6ntq9f8@4ax.com> |
| In reply to | #12090 |
On Thu, 23 Feb 2012 06:57:31 -0600, Bootleg Bart <jknmp@axcop.org>
wrote:
I put the files online and it works fine with FireFox. Weird!
>On Thu, 23 Feb 2012 05:55:40 -0600, Bootleg Bart <jknmp@axcop.org>
>wrote:
>
>
>I changed the onclick to - onclick="allLinks('360v6.htm')"
>
>function allLinks(link){
>window.location.href = link;
>}
>
>And the same thing as described below. FireFox doesn't open a new
>window or tab.
>
>
>>onclick works and changes the self location in IE and Chrome. A new
>>window is also opened with the href="javascript:v6" in IE and Chrome.
>>
>>FireFox - onclick changes the self.location but doesn't open a new
>>window.What am I doing wrong? Thanks.
>>
>>
>><area coords="159, 110, 234, 127"
>>href="javascript:v6('securitydetails.htm','_blank','scrollbars=yes,resizable=yes,width=780,height=690,top=0,left=0')"
>>onclick="setTimeout(window.location.href='360v6.htm', 500)"
>>shape="rect" />
[toc] | [prev] | [next] | [standalone]
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Date | 2012-02-23 14:58 +0100 |
| Message-ID | <2263175.FRqVoOGUtd@PointedEars.de> |
| In reply to | #12087 |
Bootleg Bart wrote:
> onclick works and changes the self location in IE and Chrome. A new
> window is also opened with the href="javascript:v6" in IE and Chrome.
>
> FireFox - onclick changes the self.location but doesn't open a new
> window.What am I doing wrong? Thanks.
_Firefox_
> <area coords="159, 110, 234, 127"
RTFM. There are not supposed to be spaces in that attribute value. Some
parsers are more forgiving than others.
>
href="javascript:v6('securitydetails.htm','_blank','scrollbars=yes,resizable=yes,width=780,height=690,top=0,left=0')"
Please read the FAQ on `javascript:' URIs.
<http://jibbering.com/faq/>
> onclick="setTimeout(window.location.href='360v6.htm', 500)"
> shape="rect" />
This assigns '360v6.htm' to window.location.href, which causes navigation
*before* setTimeout() is called (as the assignment is the expression that
makes up the argument). If you are lucky, setTimeout() can be called; if
not, a TypeError exception will be thrown because the object previously
referred to by `setTimeout' has already been destructed because of
navigation.
In general, you are looking for
window.setTimeout(function () { window.location = '360v6.htm'; }, 500);
although that does not make much sense here. Why do you want to slow down
the user?
PointedEars
--
Danny Goodman's books are out of date and teach practices that are
positively harmful for cross-browser scripting.
-- Richard Cornford, cljs, <cife6q$253$1$8300dec7@news.demon.co.uk> (2004)
[toc] | [prev] | [next] | [standalone]
| From | Bootleg Bart <jknmp@axcop.org> |
|---|---|
| Date | 2012-02-23 08:48 -0600 |
| Message-ID | <34kck79lo4cldqbpl5n7o89ecr1t5uj0aj@4ax.com> |
| In reply to | #12094 |
On Thu, 23 Feb 2012 14:58 +0100, Thomas 'PointedEars' Lahn
<PointedEars@web.de> wrote:
Thanks a lot, PointedEars. That worked. I use the setTimeout because
it was my understanding that when using more than one instruction,
when they're rendered too quickly, it may cause one of them not to
work. I try to slow down the second instruction a little. That may be
out of date now but I'm still doing it.
>Bootleg Bart wrote:
>
>> onclick works and changes the self location in IE and Chrome. A new
>> window is also opened with the href="javascript:v6" in IE and Chrome.
>>
>> FireFox - onclick changes the self.location but doesn't open a new
>> window.What am I doing wrong? Thanks.
>
>_Firefox_
>
>> <area coords="159, 110, 234, 127"
>
>RTFM. There are not supposed to be spaces in that attribute value. Some
>parsers are more forgiving than others.
>
>>
>href="javascript:v6('securitydetails.htm','_blank','scrollbars=yes,resizable=yes,width=780,height=690,top=0,left=0')"
>
>Please read the FAQ on `javascript:' URIs.
>
><http://jibbering.com/faq/>
>
>> onclick="setTimeout(window.location.href='360v6.htm', 500)"
>> shape="rect" />
>
>This assigns '360v6.htm' to window.location.href, which causes navigation
>*before* setTimeout() is called (as the assignment is the expression that
>makes up the argument). If you are lucky, setTimeout() can be called; if
>not, a TypeError exception will be thrown because the object previously
>referred to by `setTimeout' has already been destructed because of
>navigation.
>
>In general, you are looking for
>
> window.setTimeout(function () { window.location = '360v6.htm'; }, 500);
>
>although that does not make much sense here. Why do you want to slow down
>the user?
>
>
>PointedEars
[toc] | [prev] | [next] | [standalone]
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Date | 2012-02-23 15:59 +0100 |
| Message-ID | <1814638.QlL2i0oi4I@PointedEars.de> |
| In reply to | #12103 |
Bootleg Bart wrote: > Thanks a lot, PointedEars. That worked. I use the setTimeout because > it was my understanding that when using more than one instruction, > when they're rendered too quickly, it may cause one of them not to > work. I try to slow down the second instruction a little. That may be > out of date now but I'm still doing it. You are mistaken. window.setTimeout() was never necessary in that context. You need to learn to post, in particular how to quote. <http://jibbering.com/faq/#posting> PointedEars -- > If you get a bunch of authors […] that state the same "best practices" > in any programming language, then you can bet who is wrong or right... Not with javascript. Nonsense propagates like wildfire in this field. -- Richard Cornford, comp.lang.javascript, 2011-11-14
[toc] | [prev] | [next] | [standalone]
| From | Bootleg Bart <jknmp@axcop.org> |
|---|---|
| Date | 2012-02-23 08:51 -0600 |
| Message-ID | <dhkck7p4vul28vii5idd6qrv0a6kmouvrf@4ax.com> |
| In reply to | #12094 |
On Thu, 23 Feb 2012 14:58 +0100, Thomas 'PointedEars' Lahn
<PointedEars@web.de> wrote:
>RTFM. There are not supposed to be spaces in that attribute value. Some
>parsers are more forgiving than others.
One other thing concerning the spaces; that has nothing to do with
anything. You need to read a different manual.
>Bootleg Bart wrote:
>
>> onclick works and changes the self location in IE and Chrome. A new
>> window is also opened with the href="javascript:v6" in IE and Chrome.
>>
>> FireFox - onclick changes the self.location but doesn't open a new
>> window.What am I doing wrong? Thanks.
>
>_Firefox_
>
>> <area coords="159, 110, 234, 127"
>
>RTFM. There are not supposed to be spaces in that attribute value. Some
>parsers are more forgiving than others.
>
>>
>href="javascript:v6('securitydetails.htm','_blank','scrollbars=yes,resizable=yes,width=780,height=690,top=0,left=0')"
>
>Please read the FAQ on `javascript:' URIs.
>
><http://jibbering.com/faq/>
>
>> onclick="setTimeout(window.location.href='360v6.htm', 500)"
>> shape="rect" />
>
>This assigns '360v6.htm' to window.location.href, which causes navigation
>*before* setTimeout() is called (as the assignment is the expression that
>makes up the argument). If you are lucky, setTimeout() can be called; if
>not, a TypeError exception will be thrown because the object previously
>referred to by `setTimeout' has already been destructed because of
>navigation.
>
>In general, you are looking for
>
> window.setTimeout(function () { window.location = '360v6.htm'; }, 500);
>
>although that does not make much sense here. Why do you want to slow down
>the user?
>
>
>PointedEars
[toc] | [prev] | [next] | [standalone]
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Date | 2012-02-23 15:55 +0100 |
| Message-ID | <6220096.MgZq6PjM2B@PointedEars.de> |
| In reply to | #12104 |
Bootleg Bart wrote:
> Thomas 'PointedEars' Lahn wrote:
>> RTFM. There are not supposed to be spaces in that attribute value. Some
>> parsers are more forgiving than others.
>
> One other thing concerning the spaces; that has nothing to do with
> anything. You need to read a different manual.
You need to learn (X)HTML, and the importance of Valid markup in general, in
particular with Web scripting:
<http://www.w3.org/TR/html4/struct/objects.html#adef-coords>
<http://www.w3.org/TR/html5/the-map-element.html#attr-area-coords>
PointedEars
--
realism: HTML 4.01 Strict
evangelism: XHTML 1.0 Strict
madness: XHTML 1.1 as application/xhtml+xml
-- Bjoern Hoehrmann
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.javascript
csiph-web