I'm trying to use object pointers to access/modify various properties of
various layers.
The problem i'm having is that pointers created within my functions dont
have world scope even though the variables used are world variables.
Script Example:
<script>
var lyr1, lyr2;
function initIE(){
lyr1 = layer1.style;
lyr2 = layer2.style;
lyr1.z = lyr1.zIndex;
lyr2.z = lyr2.zIndex;
};
function switcher(a){
lyr1.z = 9;
lyr2.z = 8;
a.style.zIndex = 11;
};
</script>
Now when switcher(a) is called lines 1 & 2 do not effect the 2 layer's
z-index while line 3 does what I want it to.
So I'm assuming that the object pointers created in initIE() are not given
world scope.
How do I rectify this?
TIA
S.Taylor 4 6980
"Ralph??" <ra******@stis.net> writes: I'm trying to use object pointers to access/modify various properties of various layers. The problem i'm having is that pointers created within my functions dont have world scope even though the variables used are world variables.
.... Now when switcher(a) is called lines 1 & 2 do not effect the 2 layer's z-index while line 3 does what I want it to. So I'm assuming that the object pointers created in initIE() are not given world scope.
They are, but they don't work as you seem to expect them to.
After initIE, you have two object references, lyr1 and lyr2, each
pointing to a style object. Inside that style object is a property
called "z", which has nothing to do with the style of an element. It
currently holds the same value as the "zIndex" property of the same
element. Changing the "z" property does nothing to the "zIndex"
property.
How do I rectify this?
Forget the "z" property and change the two first lines of switcher to
lyr1.zIndex = 9;
lyt2.zIndex = 8;
/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
'Faith without judgement merely degrades the spirit divine.'
"Ralph??" <ra******@stis.net> wrote in message
news:ba******************************@free.teranew s.com... I'm trying to use object pointers to access/modify various properties of various layers. The problem i'm having is that pointers created within my functions dont have world scope even though the variables used are world variables.
Script Example: <script> var lyr1, lyr2;
That will correctly define the two global variables.
function initIE(){ lyr1 = layer1.style;
Assuming that the fact that the function is called "initIE" indicates
that you don't expect to use this code on non-IE browsers and that a DOM
element exists with the ID "layer1" then this code will set the global
variable - lyr1 - to a reference to that element's - style - object.
Thus - lyr1 - is a reference to an object.
lyr2 = layer2.style; lyr1.z = lyr1.zIndex;
As - lyr1 - is a reference to a - style - object and style objects do
not have a - z - property, the - lyr1.z - code will create a new
property on the element's style object. That new property will be set to
the value read from the - zIndex - property of that same - style -
object. However, the - zIndex - property of a - style object is usually
a string, so the new - z - property on the style object is assigned a
string value.
lyr2.z = lyr2.zIndex; };
function switcher(a){ lyr1.z = 9;
Now you are re-setting the - z - property that you created on the -
style - object to a numeric value. This will have no consequences for
the displayed page because the - style - object has no interest in your
setting your own values to your own properties. If you want a - style -
object to react you need to be setting the value of the properties that
it understands, in this case - zIndex -. Try:-
lyr1.zIndex = 9;
lyr2.z = 8; a.style.zIndex = 11; }; </script>
<snip>
"Lasse Reichstein Nielsen" <lr*@hotpop.com> wrote in message
news:n0**********@hotpop.com... "Ralph??" <ra******@stis.net> writes:
Forget the "z" property and change the two first lines of switcher to lyr1.zIndex = 9; lyt2.zIndex = 8;
Thank you, I realized , about 2 hours after posting, that you can't make an
object pointer to a property that contains a value, that the pointer will
be used as a variable, instead.
"Richard Cornford" <Ri*****@litotes.demon.co.uk> wrote in message
news:be*******************@news.demon.co.uk... "Ralph??" <ra******@stis.net> wrote in message news:ba******************************@free.teranew s.com...I'm trying to use object pointers to access/modify various properties of various layers. The problem i'm having is that pointers created within my functions dont have world scope even though the variables used are world variables.
Script Example: <script> var lyr1, lyr2;
That will correctly define the two global variables.
function initIE(){ lyr1 = layer1.style;
Assuming that the fact that the function is called "initIE" indicates that you don't expect to use this code on non-IE browsers and that a DOM element exists with the ID "layer1" then this code will set the global variable - lyr1 - to a reference to that element's - style - object. Thus - lyr1 - is a reference to an object.
lyr2 = layer2.style; lyr1.z = lyr1.zIndex;
As - lyr1 - is a reference to a - style - object and style objects do not have a - z - property, the - lyr1.z - code will create a new property on the element's style object. That new property will be set to the value read from the - zIndex - property of that same - style - object. However, the - zIndex - property of a - style object is usually a string, so the new - z - property on the style object is assigned a string value.
lyr2.z = lyr2.zIndex; };
function switcher(a){ lyr1.z = 9;
Now you are re-setting the - z - property that you created on the - style - object to a numeric value. This will have no consequences for the displayed page because the - style - object has no interest in your setting your own values to your own properties. If you want a - style - object to react you need to be setting the value of the properties that it understands, in this case - zIndex -. Try:-
lyr1.zIndex = 9;
lyr2.z = 8; a.style.zIndex = 11; }; </script> <snip>
Thank you, I realized , about 2 hours after posting, that you can't make an
object pointer to a property that contains a value, that the pointer will
be used as a variable, instead. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: jimjim |
last post by:
Hello,
This is a simple question for you all, I guess .
int main(){
double *g= new double;
*g = 9;
delete g;
cout<< sizeof(g)<<" "<<sizeof(double)<<" "<<sizeof(*g)<<" "<<*g<<" "<<endl;
*g =...
|
by: ozbear |
last post by:
This is probably an obvious question.
I know that pointer comparisons are only defined if the two pointers
point somewhere "into" the storage allocated to the same object, or if
they are NULL,...
|
by: Divick |
last post by:
Hi,
I am designing an API and the problem that I have is more of a
design issue. In my API say I have a class A and B, as shown below
class A{
public:
void doSomethingWithB( B * b)
{
//do...
|
by: Belebele |
last post by:
Suppose that a class A depends on class B because an object of class B
is passed into A's constructor. See below:
class B { ... };
class A {
public:
A(B const& b);
...
};
|
by: Martin |
last post by:
Hi
I need to maintain a <setof pointers to objects, and it must be
sorted based on the values of pointed objects, not pointer values. I
can achieve this easily by defining my own comparing...
|
by: vijay.gandhi |
last post by:
Hi,
I am trying to convert some unmanaged code (C++) to managed code
(using C++/CLI).
1) One of the functions used returns a void* which I need to cast into
a handle of a managed object. Can...
|
by: Joe |
last post by:
I am just starting to use Object Oriented PHP coding, and I am seeing
quite often the following (this example taken from a wiki):
$wakka =& new Wakka($wakkaConfig);
What exactly is the =&, and...
|
by: krishna.kishore.0987 |
last post by:
Why are always object pointers used? (i.e., ObjectType *objPointer)
what are the advantages of using object pointers Vs objects
(ObjectType obj)
one advantage I see is passing them across methods,...
|
by: WaterWalk |
last post by:
Hello. When I consult the ISO C++ standard, I notice that in
paragraph 3.6.2.1, the standard states:
"Objects with static storage duration shall be zero-initialized before
any other...
|
by: Astley Le Jasper |
last post by:
Sorry for the numpty question ...
How do you find the reference name of an object?
So if i have this
bob = modulename.objectname()
how do i find that the name is 'bob'
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |