spacer
Yehuda Shiran July 9, 2000
HTC-Master Focus/Blur Events
Tips: July 2000

Yehuda Shiran, Ph.D.
Doc JavaScript

Developer News
News Flash: Adobe Has iPhone Workaround
Adobe's Flash 10.1 Goes Mobile (Minus iPhone)
A Salute to Visionary CEOs

One of the most frustrating deficiencies of scripting a DHTML element is that you must initialize its STYLE before you can set or modify it during a script. Suppose you have the following DIV element:

<DIV ID="oSun"><IMG SRC="planet.gif"></DIV>

And at some point during your script you want to set the position of the above DIV element. You would probably write something like:

oSun.style.left = 50;
oSun.style.top = 70;

You try to run it and nothing comes up on the screen. The reason? The STYLE tag has not been defined for the above DIV element. Defining the STYLE is straightforward:

<STYLE>
.block {position: absolute; top: 100; left: 100}
</STYLE>

Once the style parameters are predefined, you can modify them via the script, as shown above.


People who read this tip also read these tips:

Look for similar tips by subject:

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs

webref The latest from WebReference.com Browse >
Building a Banking Application Home Page with OOP · Mixing Scripting Languages · Review: phpFox, a Social Networking CMS with all the Bells and Whistles
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Enterprise 2.0: Social Networking in the Cloud · BroadSoft Marketplace Hastens Pace of Telephony Innovation · Review: HTC Hero for Sprint