
Signature
Steve
We must believe in luck. For how else can we explain the success of
those we don't like? -Jean Cocteau
Um... I'm familiar w/ this sample, and read-up a little before posting this
question. I might be way off, but this has nothing to do w/ my question.
The sample doesn't "set" STYLE properites, it simply applies already
hard-coded styles to objects dynamically. Again, I need to calculate the
actual position upon page load and literally set this style property in
real-time.
"En cuanto mas personas conozca, mas me gusta mi pero."
Camilo Jose Cela.
> > I need to set the background-position of a style in real-time, with onload
> > event via JScript. Assuming this is possible, can anyone tell me how?
>
> RTFM.
> background-position Attribute | backgroundPosition Property
> http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/backgroundp
osition.asp
charliewest - 12 Mar 2005 17:51 GMT
oh.. yes... i forgot to write RTFQ. Thanks,
> Um... I'm familiar w/ this sample, and read-up a little before posting this
> question. I might be way off, but this has nothing to do w/ my question.
[quoted text clipped - 13 lines]
> > background-position Attribute | backgroundPosition Property
> > http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/backgroundp
osition.asp
Steve Fulton - 13 Mar 2005 13:37 GMT
[quoting noramlized; sigs trimmed]
>> > > I need to set the background-position of a style in real-time, with onload
>> > > event via JScript. Assuming this is possible, can anyone tell me how?
[quoted text clipped - 11 lines]
>
> oh.. yes... i forgot to write RTFQ. Thanks,
Where in the FQ did you say that you had read up before posting? That
you knew anything about the backgroundPosition property (as opposed
to the (background-position attribute)?
How To Ask Questions The Smart Way
http://www.catb.org/~esr/faqs/smart-questions.html
The second example shows how to change the background position using
the backgroundPosition property. I will concede that the example uses
a hard-coded value; but you never gave any information about how to
calculate the actual position. I apologize for assuming that you knew
how to determine what background position you needed.
<body onload="
var elem = document.getElementById('someIdYouNegelectedToMention');
if (someConditionYouNegelectedToMention) {
var pos = someCalculationYouNegelectedToMention;
}
else {
pos = anAlternateCalculationYouNegelectedToMention;
}
elem.style.backgroundPosition = pos;
">

Signature
Steve
An army of sheep led by a lion could easily defeat an army of lions
led by a sheep. -Arab Proverb