Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #7673

Re: function call location?

From Dr J R Stockton <reply1143@merlyn.demon.co.uk>
Newsgroups comp.lang.javascript
Subject Re: function call location?
Date 2011-10-24 19:43 +0100
Organization Home
Message-ID <7rMRzdJvHbpOFwfB@invalid.uk.co.demon.merlyn.invalid> (permalink)
References <iVY38EH54GoOFwnv@invalid.uk.co.demon.merlyn.invalid> <20ecde0b-c4e3-44df-9e34-a447753b0fb9@g16g2000yqa.googlegroups.com> <Iw2tVDKADwoOFwho@invalid.uk.co.demon.merlyn.invalid> <d29d6f09-972a-4e45-85a9-85d2c052da38@hj4g2000vbb.googlegroups.com>

Show all headers | View raw


In comp.lang.javascript message <d29d6f09-972a-4e45-85a9-85d2c052da38@hj
4g2000vbb.googlegroups.com>, Sun, 23 Oct 2011 10:00:18, Scott Sauyet
<scott.sauyet@gmail.com> posted:

>Dr J R Stockton wrote:
>> [ ... alert boxes problematic ... ]
>> My Web site has, counting with MiniTrue, 566 calls of alert.
>>
>> So I was thinking of replacing window.alert with another function Alert
>> or by editing replace calls of alert with ones of Alert by editing the
>> source (with MiniTrue).  The new function Alert would insert a suitable
>> box somewhere on the page.  In practice, inserting before or after the
>> script element could be a good default (a second argument, if provided,
>> would choose a location).  Alternatively, the function Alert could open
>> a new window.
>>
>> The same would apply to window.confirm and window.prompt.


>Why would it matter where in the markup the box was placed?

For my pages, that would in general put it near, but not on, the cause
of the Alert, which would be a good start.


>Presumably you would want this to sit in a higher z-index than the
>surrounding content, so wouldn't simply placing this with
>position:absolute (and allowing whatever drag options you choose) be a
>sensible alternative.

It would.  Remember that the most effective way of finding a good
solution is to present a possible solution in a Usenet newsgroup.  I'd
never given any thought to z-index until last week, when I wanted
(because of another nasty in Firefox 7) to put a large outline - the
border of an empty div - on a page, position absolute.  That's OK, and
it was transparent; but it masked clicks on what was showing through,
and z-index fixed that.  However, ISTM that now I'd have to discover the
Y-position to give it.

>  Then the box could be placed in an arbitrary
>spot in the markup.  (For such things, I usually simply append to the
>end of the BODY.)
>
>There are numerous libraries available to add dialogs to web pages.
>Can you simply use one of them?

It will take me longer to find and understand a sound one than to
implement an acceptable solution using a well-placed and initially non-
displayed div element, accessed by getElementById.

>As the the original question, I rather doubt there would be any clean
>way to do this, but by throwing and catching an exception, you might
>be able to track the calling function to its URL and line number in
>some browsers.

Must be all likely GUI browsers, at least.

-- 
 (c) John Stockton, nr London UK.  ?@merlyn.demon.co.uk  Turnpike v6.05  MIME.
   <http://www.merlyn.demon.co.uk/>  TP/BP/Delphi/&c., FAQqy topics & links;
   <http://www.merlyn.demon.co.uk/clpb-faq.txt>    RAH Prins : c.l.p.b mFAQ;
   <ftp://garbo.uwasa.fi/pc/link/tsfaqp.zip>  Timo Salmi's Turbo Pascal FAQ.

Back to comp.lang.javascript | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

function call location? Dr J R Stockton <reply1142@merlyn.demon.co.uk> - 2011-10-20 19:53 +0100
  Re: function call location? Antony Scriven <adscriven@gmail.com> - 2011-10-20 17:13 -0700
    Re: function call location? Dr J R Stockton <reply1142@merlyn.demon.co.uk> - 2011-10-22 18:43 +0100
      Re: function call location? Scott Sauyet <scott.sauyet@gmail.com> - 2011-10-23 10:00 -0700
        Re: function call location? Dr J R Stockton <reply1143@merlyn.demon.co.uk> - 2011-10-24 19:43 +0100
          Re: function call location? Scott Sauyet <scott.sauyet@gmail.com> - 2011-10-25 05:13 -0700
            Re: function call location? Dr J R Stockton <reply1143@merlyn.demon.co.uk> - 2011-10-26 20:13 +0100
      Re: function call location? Antony Scriven <adscriven@gmail.com> - 2011-10-24 02:11 -0700
        Re: function call location? Dr J R Stockton <reply1143@merlyn.demon.co.uk> - 2011-10-25 19:28 +0100
          Re: function call location? Scott Sauyet <scott.sauyet@gmail.com> - 2011-10-26 05:09 -0700
            Re: function call location? Dr J R Stockton <reply1143@merlyn.demon.co.uk> - 2011-10-27 19:27 +0100
              Re: function call location? Antony Scriven <adscriven@gmail.com> - 2011-10-27 17:25 -0700
                Re: function call location? Dr J R Stockton <reply1143@merlyn.demon.co.uk> - 2011-10-29 20:36 +0100

csiph-web