Re: div as big as the document



On May 27, 12:41 am, Daniel <dan...@xxxxxxxxxxxxx> wrote:
On Tue, 26 May 2009 20:06:07 -0700 (PDT), David Mark



<dmark.cins...@xxxxxxxxx> wrote:
On May 26, 11:39 pm, Daniel <dan...@xxxxxxxxxxxxx> wrote:
On Tue, 26 May 2009 18:03:35 -0700 (PDT), David Mark

<dmark.cins...@xxxxxxxxx> wrote:
On May 26, 9:48 pm, Daniel <dan...@xxxxxxxxxxxxx> wrote:
Hi,

I would like to implement some "modal" dialogs in javascript -  I read
the approach is set a semiopaque div covering the entire document and
place the dialog (another div) on the top of this one, in the middle
of the screen.

No modality there.  Just a big element.  That should tell you
something about this popular approach to modality.

Thanks for answering; I know it is just a work around, but this time I
have to do this way.

Do you know another approach?

Yes.  Think about what modality means.

From a browser window, what other options do you have? This one kinda
mimic a little bit the modal approach.

It's an illusion.

Till now I used to do the old
fashion way - show a table, click on a line, go to edit page, etc. Now
I try this approach only for this business flow,

Why?

I was pretty close
till I ran in the issues, now it seems the issues will be gone.

Mixed emotions. You are likely removing the last perceived barriers
between a gun and your foot.


For the future, what other modal approach would you use?

I don't know what you are hiding behind the curtain, so I can't tell
you how to make it respect a modal dialog. The libraries don't know
either, so they just slap a DIV over it and call it modality.
Basically, any attempts to use the underlying interface must be
rebuffed.




function getDiv(bd){
        // create  a div element
        var div = document.createElement('DIV');

        var elem = $(div);

Another popular pattern.  Skip this.

It's from prototype; which js framework do you use?

Prototype, jQuery and others like them are not frameworks.  They are
just very poor examples of Javascript.  The idea behind them was
relevant five years ago, but not today.  They never did get close to
reaching their goals; just flotsam and jetsam now.

        elem.addClassName("objfill");

div.className = 'objfill';

agree;

See.  No framework needed.  Virtually any string of framework-induced
gobbledygook can be "translated" to simple DOM scripting if you know
what you are doing.  You cut out all of the bloat, needless
complexity, bugs, etc. and everything runs 100 times faster.  That's
what the framework authors don't want you to know.  They'd prefer that
you continue to buy their worthless books.

OK; personally I agree with the point; now, you still need some
library for getting things like Ajax requests and stuff in a decent
manner (a cross browser solution). For this kind of stuff, what do you
use?

Here's the thing. Prototype, jQuery, etc. are not cross-browser
code. They are multi-browser magic spells. I don't use any third-
party code and I doubt my needs match yours anyway. Perhaps look into
Peter's "Fork Javascript." It's certainly got cross-browser Ajax
covered. Have a look at the code behind it and you'll see that Ajax
holds very few mysteries. Well, unless you are John Resig (jQuery's
Ajax code throws exceptions in common IE configurations.)






        elem.style.width = bd.clientWidth +"px";

div.style.width = bd.clientWidth +"px";

        var height = bd.scrollHeight;
        height = height > window.innerHeight ? height :
window.innerHeight;
        elem.style.height = height + "px";

div.style.height = height + "px";

        return elem;

return div;

}

The "bd" as the function parameter is the reference to the BODY tag..

That's unfortunate as you want the documentElement in most browsers.

The above construct does not work properly; something is wrong but I
don't know what.

Start with bd and lose whatever script introduced those "$" calls.
They indicate a bad script.  No bias towards scripts in general, but
bad scripts can't help you (see jQuery, Prototype, etc.)

So the conclusion is that there is no cross browser consistent
approach to get document dimensions?

No.  Where did you get that?

Sorry, I see the differences now; will get on it and ask some more
question on the way.

Okay.


Thanks a lot for all the info!


No problem.
.



Relevant Pages

  • Re: Javascript causing CSS margin bug in IE
    ... AJAX transactions and not using the ASP.NET AJAX controls? ... you have an update panel somewhere or the AJAX would not work. ... In this way, if the inner DIV is updated, you do not have to reapply the ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: executing javascript set with innerHTML in IE 7
    ...   if ... The script is already set in the html that I'm ... returning from an Ajax call and it needs to run inside the div that I ...
    (comp.lang.javascript)
  • Attempting to access a dynamically created div
    ... static div using ajax. ... Each answer is itself in a div. ... The autosuggest part isn't important, ... which produce such suggestion lists are dynamically added and numerous ...
    (comp.lang.javascript)
  • Re: AJAX Issue In Twitter Utility
    ... I encountered an AJAX issue while working on it and was wondering ... This is not a security issue on your host. ... also offer Python and Ruby CGI scripts). ...
    (comp.lang.javascript)
  • Re: Cant figure out ajax/php problem.
    ... display an alert make the DIV visible via CSS. ... Well I have a DIV that messages display in that is refreshed via ajax every ... it in my PHP script that is being called by AJAX. ...
    (comp.lang.php)