c-- styles for logos and headline links do not modify internet, red, or black styles -->

Intranet Journal   Earthweb  
Events Jobs Premium Services Media Kit Network Map E-mail Offers Vendor Solutions Webcasts

   Intranet Journal Subjects
Search Earthweb

Privacy Policy



internet.com
IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers

internet commerce
Be a Commerce Partner
















 

[ Home | Discussion Forum | How Do I... | Lotus Notes Intranets | Microsoft SharePoint | Products | Shopping  ]

free news!

Dynamic Properties in Dynamic HTML (DHTML)



Tutorial TOC

  1. Introduction
  2. Implementing Dynamic Properties
  3. Creating expressions and formulas
  4. The setting expressions
  5. The getExpression() method
  6. The removeExpression() method
  7. Summary

The setting expressions

Before IE 5, a property's value could only be set using a static variable. If you needed an element's property values to be dependent on another property value, you. d need to manually trap these state changes and perform the appropriate updates. A simpler way is to let IE take care of that for you, however there are times when an expression may not be updated automatically. If this happens just call the recalc() method and set It's parameter to true. This will cause all expression to be evaluated manually. To set a property value to an expression or formula, use either expression() or the setExpression() method. The method you use will depend on where you are setting your Dynamic Properties. If you are setting them in an embedded or inline style sheet, you need to use expressios(). When working with setting expressions in scripts, the setExpression() method is what you need to use. Once you. ve set a properties value using expression() or the setExpression() method, it becomes a Dynamic Property. let's look at how to use these methods:

In HTML, use the following:

<element style="AttributeName:expression(DynamicExpression)">

This works in the same ways as when defining style for elements on your page. But, instead of entering a static value for the CSS attribute value, the expression() method along with the desired expression replaces the static value. One added advantage of using expression() is the fact that browsers that don't support Dynamic Properties will simply ignore this piece of code, this reduces your need to with any browser sniffing scripts.

When scripting, use the following:

object.setExpression(PropertyName, DynamicExpression, ScriptLanguage)

With the scripting syntax, object represents any of the DHTML objects. PropertyName represents the read/write property of the object you are referencing. The ScriptLanguage parameter is an optional parameter that you can use to indicate which scripting language the expression is written in. By default, the language is JScript, but you can also set it to JavaScript or VBScript.

Our first example uses both setExpression() and expression() to create an interesting script that  we're sure you'll have fun playing around with.

[print version of this page]

Of Interest
· An Introduction to DHTML

· Express Yourself