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

Yehuda Shiran, Ph.D.
Doc JavaScript

Developer News
Google Going Native With Chrome
Mozilla Fixes Firefox Flaws as 3.5 Release Nears
Microsoft and Novell Still Bosom Buddies

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 >
XML and PHP Simplified · Creating a ASP.NET Contact Form · Data Filtering with PHP
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Intel to Host Live Nehalem Q&A · 12 Tips to Troubleshoot Network File-Sharing · 10 Tips for Selling on Kijiji