[quoting noramlized; sigs trimmed]
[quoted text, click to view] charliewest wrote:
> "charliewest" wrote:
>
>> "Steve Fulton" wrote:
>>
>> > charliewest wrote:
>> >
>> > > 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/backgroundposition.asp >>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.
>
> 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;
">
--
Steve
An army of sheep led by a lion could easily defeat an army of lions