[thelist] DHTML questions...

The Optimizer chrism at puffofsmoke.net
Thu Nov 15 10:45:17 CST 2001


[..]
> > > function locateBox(top_loc,left_loc)
> > >     {
> > >     return top_loc;
> > >     return left_loc;
> > >     }
> >
> >First point, you need to understand variable scope.  These are local
> >variables, their scope being within the function only.
>
> So?

*sigh* people are awfully quick to argue on this list. You can hardly
dispute the need for comprehension of the difference between global and
local variables in JavaScript if one wishes to know how to use it
effectively.

> Their values are returned, not the variables themselves.

No they aren't. Hence the need to understand variable scope, and the manner
in which to use global and local variables. A function can only return one
value, thus only the first value is returned. If global variables had been
set in the function, then both values would have been available.

[..]
> >In order to relocate the div dynamically, you will have to write/use a
> >cross-browser wrapper, and then manipulate the div through the Document
> >Object Model (DOM). Unfortunately the DOM is different for different
> >browsers, hence the need for the wrapper.
>
> See http://www.xs4all.nl/~ppk/js/index.html?dhtmloptions.html for a very
> simple cross-browser DOM wrapper. This is not a reason not to use DHTML.

Absolutely not. Not stated or implied. Perhaps inferred.

[..]

> > > Now, second question - even should I get this working, am I
> > > headed down the
> > > wrong path??? Take a look at
> >
> >Utterly, IMHO.
>
> I disagree. I think it's a very good idea. It's simple, everyone

Good *idea*, wrong *path to achieve good idea*. Apologies if this was
unclear. What I was getting at was that if there are time constraints on the
project as functionally and visually stated, it would be potentially
unrealistic to assume that one could learn enough about coding JavaScript
and DOM structure even with the use of a third party wrapper. If there are
no time constraints, then it would be a constructive excercise to learn
these things.

[..]
> >Not that I've checked, but I would imagine that the reason for
> this is that
> >NS 4.7 does not support the writeIn method, FWIW.
>
> No, that's not true. It is the document.writing of inline style
> elements, as
> I said before.

*shrug* Wild guess. I sent my mail before I received yours, or I wouldn't
have bothered even guessing. You seem to have the answer frighteningly often
:)

[..]

Regards

Chris Marsh





More information about the thelist mailing list