Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using inline expressions for value property
Message
From
27/09/2001 13:12:53
 
General information
Forum:
Internet
Category:
Javascript
Miscellaneous
Thread ID:
00561252
Message ID:
00561555
Views:
25
>>>Remove spaces after < character in the following code.
>>>
>>>
>>>Field1 < input name=f1 >
>>>Field2 < input name=f2 >
>>>Sum < input name=f3 value=javascript:"return f1.value+f2.value;" >
>>>
>>
>>How about something like this...
>>
>>
>>< script >
>>function setf3value()
>>{
>>f3.value = parseInt(f1.value) + parseInt(f2.value)
>>}
>>< /script >
>>Field1 < input name=f1 value = 0 onblur="setf3value()" >
>>Field2 < input name=f2 value = 0 onblur="setf3value()" >
>>Sum < input name=f3 value="" >
>>
>
>Wayne;
>
>The part
>
> "However, I need to set dynamic value property directly in f3 without script."
>
>threw me for a loss. I have no idea how to do it without a bit of java script. If someone is able to answer the original question as defined I will be interested. Perhaps web applications are not as "brain dead" as I have thought!

I need more elegant solution.

From MS KB under dynamic properties chapter:

Handling events can get fairly involved and inefficient. Implementing event handlers on a document that is not fully known at design time (database driven Web pages or pages with data binding, for example) is only possible with event bubbling . As a result, authors frequently implement a single global handler at the top of the event chain to update everything. On the other hand, with dynamic properties, authors can automatically determine a minimal and optimal recalculation of properties and evaluate only the expressions that really need to be evaluated.

... also

This frees authors from the requirement of learning script programming before they can design advanced features for their pages.

I can force using Internet explorer. I read about setExpresson() method in
MSKB, run its samples and found that using setExpresson() is more
elegant implementation of this: no need to write separate javascript
functions!

There is also a sample in MSKB about setting dynamic style properties like

< INPUT TYPE=text
STYLE="width:expression(eval(oBox1.value)+eval(oBox2.value))" >

Unfortunately, value property does not belong to style.

However, description of < input type=text> element VALUE attribute
says that

Expressions can be used in place of the preceding value(s), as of Microsoft® Internet Explorer 5. For more information, see Dynamic Properties.

I read July MSKB "Dynamic properties chapter" but does'nt found referred "more information"!
How to specify dynamic expression for value attribute ?
Andrus
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform