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

Yehuda Shiran, Ph.D.
Doc JavaScript

Developer News
Microsoft Shows Off Silverlight 4, IE9 Plans
Metasploit Expands Vulnerability Test Framework
HyperCard Reborn?

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, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs

webref The latest from WebReference.com Browse >
Rolling Out Your Own HTML Application Version Control · HTML 5: Client-side Storage · Working with Ajax Server Extensions
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Wi-Fi Product Watch, November 2009 · Chip Market Recovering From '08 Collapse · Low-Cost Tools to Kickstart Your New Business