HBCMS更多的中文手册参考:

BY Attribute | by参数属性

DHTML中文手册

Sets or retrieves a relative offset value by which to animate a color attribute or property with the t:ANIMATECOLOR element.

dhtml语法

HTML<t:ANIMATECOLOR BY = vValue... >
Scriptingt:ANIMATECOLOR.by(val) [ = vValue ]

DHTML可能的值

vValueVariant that specifies or receives the relative value used to animate an element's color properties. This is a delta value used to offset the underlying value of the attribute or property.

The property is read/write. The property has no default value.

Remarks

The by property cannot be used on the same element as the to property. if both properties are specified, the by value is ignored. however, specifying a starting value for the animation using the from property is optional.

the by property is only valid for attribute values that support addition. in the context of t:animatecolor, valid attribute values are hexadecimal rgb values or the keywords that represent them (for example, #8a2be2 or blueviolet). for more information about supported color values, see the color table.

during the course of an animation, you can change the target element's color attribute by offsetting its value with the value specified for the by property. this offset value is actually the sum of the target element's color value and the by property's value. note that if you choose to specify a starting value for the animation's target attribute by setting the from property, the end value of the target attribute will instead be the sum of the values set for the from and by properties.

if the by property is set without also setting the from property, the animation is defined to be additive and will override the additive property.

when writing script to dynamically change the properties of an active animation, developers should consider a couple of issues. because results might be unpredictable or undefined when you change the properties of an active animation, restart the animation with beginElement after you have made the change. For example:

<SCRIPT>
object.endElement();
object.by='150';
object.beginElement();
</SCRIPT>

For the animate, animatemotion, and animatecolor objects, the time2 behavior uses the following model to evaluate which properties to animate.

dhtml代码范例

the following example uses an t:animatecolor element to animate the backgroundcolor of a div element. the inner div element's backgroundcolor is set to #808000 (olive).

the outerdiv's backgroundcolor is initially set to #ff7f50 (coral). over the course of the a1 t:animatecolor element's duration, this value is offset by #808000 (olive), the value of the inner div element's backgroundcolor. since the by attribute is additive, outerdiv's backgroundcolor is calculated over the duration of the animation as the progressive sum of #ff7f50 (coral) and #808000 (olive). thus, outerdiv ends the animation with a yellow hue of #ffff50.

<html xmlns:t ="urn:schemas-microsoft-com:time">
<HEAD>
<STYLE>
.time {behavior: url(#default#time2);}
</STYLE>
<?IMPORT namespace="t" implementation="#default#time2">
</HEAD>
<BODY>
<t:PAR id="p1" dur="15" fill="hold">
<t:ANIMATECOLOR id="a1" targetElement="outerDIV"
attributeName="background-color" by="#808000" begin="1" dur="3"
fill="hold"/>
</t:PAR>
<DIV id="outerDIV" class="time" style="FONT-SIZE: 18; LEFT: 58px; WIDTH: 279px;
POSITION: absolute; TOP: 190px; HEIGHT: 217px; BACKGROUND-COLOR: #ff7f50;
TEXT-ALIGN: left; border:1px solid black; padding-left:3">outerDIV</DIV>
<DIV id="innerDIV" class="time" style="FONT-SIZE: 18; LEFT: 102px;
WIDTH: 188px; POSITION: absolute; TOP: 248px; HEIGHT: 98px;
BACKGROUND-COLOR: #808000; TEXT-ALIGN: left; padding-left:3;
border:1px solid black;">innerDIV</DIV>
</BODY>
</HTML>
This feature requires Microsoft?Internet Explorer 5.5 or later. Click the following icon to install the latest version. Then reload this page to view the sample.

applies to

t:ANIMATECOLOR

更多语法参考

color, backgroundcolor, introduction to html+time, Color Table