Hallo John (and all)
yes that would fix the script, yet it requires two statements:
this.prop="hallo world";
prop = "hello world";
which is precisely what I want to avoid: having to prepend this to all the
variables _manually_.
Ok, I describe better the problem I have:
I have a dhtml system fully developed. As every dhtml system, it starts with
a lot of variables to cover the different dhtml objects that any document
may imply, addressing them accordingly to browsers differences.
Instances:
-----------
offsetX=(typeof(pageXOffset)!="undefined")?
"pageXOffset":"document.body.scrollLeft";
offsetY=(typeof(pageYOffset)!="undefined")?
"pageYOffset":"document.body.scrollTop";
innerW=(typeof(innerWidth)!="undefined")?
innerWidth:document.body.clientWidth;
innerH=(typeof(innerHeight)!="undefined")?
innerHeight:document.body.clientHeight;
-----------
and all the paraphernalia like that.
You can have an idea what the system implies as far as the amount of
involved vars are at:
http://www.unitedscripters.com/scripts/dhtml4.html
yet viewing the file is not necessary: you can believ my word they are a lot
of variables.
Now, I was planning to encapsulate all that system (sadly already fully
developed. Yet nearly all developers make the same "mistake": with dhtml
they never think, given the amount of vars every dhtml approach requires, it
would be better to start since the beginning incapsulating them. But that's
the problem every developement implies I guess: your project always arrives
at a stage, if you carry it along long enough, when it starts having sort of
a life of its own, not envisioned at the beginning no matter how hard you
"cunningly" projected, and new exigencies arise in spite of ourselves) .
What I need would then be:
1) withdrwing from the window all the assignements of the variables, in
order to assign all of them to _one_ class, thus affecting the window with
_one_ variable dependancy only.
2) achieving that possibly avoiding prepending the 'this' keyword to every
single statement - thence the idea of the with() "function".
Yet if what with() does is to go on either appending to the window or
requiring me to write 'this' before every statement, the purpose is vanished
and my only chance would then be to rewrite the whole of the codes
encapsualting and adding 'this' to every statement.
So, no way to force with() to consider 'this' as a reference to the current
object instead than to the window. Or, in other terms, any way to force
with() to start checking what this might be from the bottom of the ladder
(the current object) instead than from the top (the window)?
Thank you a lot
Alberto