From: Thomas 'PointedEars' Lahn on
Eustace wrote:

> On 2010-03-02 18:22 Evertjan. wrote:
>> Eustace wrote on 02 mrt 2010 in comp.lang.javascript:
>>> I have a webpage with 2 frames (sidebar, content). The link is in the
>>> content frame.
>>>
>>> How can I make a link open in the whole window?
>>> [...]
>>> <a href="http://www.link.html" onclick="window.open (this.href,
>>> 'content'); return false">Link</a>
>>
>> "window.open( this.href , '_top', '');return false;"
>
> Thanks a lot. I had googled for an answer before posting but had not
> come close to finding the answer.

If the suggested solution suffices, you should use

<a href="..." target="_top" ...>...</a>

instead of scripting, so that it works everywhere.


PointedEars
--
realism: HTML 4.01 Strict
evangelism: XHTML 1.0 Strict
madness: XHTML 1.1 as application/xhtml+xml
-- Bjoern Hoehrmann
From: Evertjan. on
Thomas 'PointedEars' Lahn wrote on 03 mrt 2010 in comp.lang.javascript:

> Eustace wrote:
>
>> On 2010-03-02 18:22 Evertjan. wrote:
>>> Eustace wrote on 02 mrt 2010 in comp.lang.javascript:
>>>> I have a webpage with 2 frames (sidebar, content). The link is in
>>>> the content frame.
>>>>
>>>> How can I make a link open in the whole window?
>>>> [...]
>>>> <a href="http://www.link.html" onclick="window.open (this.href,
>>>> 'content'); return false">Link</a>
>>>
>>> "window.open( this.href , '_top', '');return false;"
>>
>> Thanks a lot. I had googled for an answer before posting but had not
>> come close to finding the answer.
>
> If the suggested solution suffices, you should use
>
> <a href="..." target="_top" ...>...</a>
>
> instead of scripting, so that it works everywhere.

Incorrect, Thomas,
in the example maybe, but the JS answer is more than that.

Try:

<a
href = "..."
target = "_top"
onclick =
"if (prompt('OK?')) window.open(this.href ,'_top',''); return false;"
>Go to the top!</a>

this will gracefully, but without the prompting question,
default to the action if JS is absent.



--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
From: David Mark on
Evertjan. wrote:
> Thomas 'PointedEars' Lahn wrote on 03 mrt 2010 in comp.lang.javascript:
>
>> Eustace wrote:
>>
>>> On 2010-03-02 18:22 Evertjan. wrote:
>>>> Eustace wrote on 02 mrt 2010 in comp.lang.javascript:
>>>>> I have a webpage with 2 frames (sidebar, content). The link is in
>>>>> the content frame.
>>>>>
>>>>> How can I make a link open in the whole window?
>>>>> [...]
>>>>> <a href="http://www.link.html" onclick="window.open (this.href,
>>>>> 'content'); return false">Link</a>
>>>> "window.open( this.href , '_top', '');return false;"
>>> Thanks a lot. I had googled for an answer before posting but had not
>>> come close to finding the answer.
>> If the suggested solution suffices, you should use
>>
>> <a href="..." target="_top" ...>...</a>
>>
>> instead of scripting, so that it works everywhere.
>
> Incorrect, Thomas,
> in the example maybe, but the JS answer is more than that.
>
> Try:
>
> <a
> href = "..."
> target = "_top"
> onclick =
> "if (prompt('OK?')) window.open(this.href ,'_top',''); return false;"
>> Go to the top!</a>
>
> this will gracefully, but without the prompting question,
> default to the action if JS is absent.
>

But it won't do very well if the window.open call fails to open a new
window (or tab). You must check the return value of that method before
determining whether to return false (which cancels the default action).
I don't see what the prompt is for either. Is what OK?



From: Dr J R Stockton on
In comp.lang.javascript message <hmlck5$pi6$1(a)speranza.aioe.org>, Wed, 3
Mar 2010 05:11:11, Eustace <emfril(a)gmail.ccom> posted:
>
>emf
>
>--
>Date Calculator with all-purpose JS code
>https://files.nyu.edu/emf202/public/js/datecalc.html

Since it does not offer Week-Numbering Dates, Ordinal Dates, the Date of
Easter, or the dates in any non-Gregorian calendar, ISTM that the claim
of "all-purpose" is considerably exaggerated.

The code in datecalc.js nowhere uses "new" : it takes no advantage of
the JavaScript Date Object, and could have been converted from some
simpler language.

The name "julianDate" is semantically incorrect; you should use
"ordinalDate". Don't copy IBM.

function isValid(yyyy, mm, dd) can more briefly be done with a Date
Object, as often discussed here in the past.

function absoluteDate(yyyy, mm, dd) can more briefly be done with a
Date Object, using new Date(Date.UTC(yyyy, mm, dd)) .

function gregorianDate(absDate) can more briefly be done with a Date
Object, using UTC.

<https://files.nyu.edu/emf202/public/js/datecalc.js> may be damaged ;
the last visible character in it is apparently '{'

The newsgroup FAQ used to have something helpful about general date/time
coding in JavaScript.

I suggest that you change your signature.

It's a good idea to read the newsgroup c.l.j and its FAQ. See below.

--
(c) John Stockton, nr London UK. ?@merlyn.demon.co.uk IE8 FF3 Op10 Sf4 Cr4
news:comp.lang.javascript FAQ <URL:http://www.jibbering.com/faq/index.html>.
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
From: Evertjan. on
David Mark wrote on 04 mrt 2010 in comp.lang.javascript:

>> Try:
>>
>> <a
>> href = "..."
>> target = "_top"
>> onclick =
>> "if (prompt('OK?')) window.open(this.href ,'_top',''); return false;"
>>> Go to the top!</a>
>>
>> this will gracefully, but without the prompting question,
>> default to the action if JS is absent.
>>
>
> But it won't do very well if the window.open call fails to open a new
> window (or tab).

'_top' will/should not open a new window or tap.

> You must check the return value of that method before
> determining whether to return false (which cancels the default action).

You could but not must.

> I don't see what the prompt is for either. Is what OK?

This was an example of coding, not of practical usefullness.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)