CSS Properties Behavior Syntax usage

Source: Internet
Author: User

Syntax for behavior:

Behavior:url (URL) | URL (#objID) | URL (#default #behaviorname)
Take value:
URL (URL): Specifies the DHTML behavior component (. htc) using an absolute or relative URL address.
URL (#objID): The behavior of using binary implementations (as ActiveX® controls). The #objID here is the id attribute value of the object
URL (#default #behaviorname): The default behavior of IE. specified by the name Identification (#behaviorName) of the behavior
Description: Sets or retrieves the DHTML behavior of an object. Multiple behaviors are separated by spaces.


When multiple behaviors that are attached to the same element collide, the result depends on the order in which the behavior is applied to the elements. The precedence of the latter behavior is higher than the previous behavior. The same rule applies to the name conflicts that occur for properties, events, and methods that are provided by different behaviors.
You can use the Addbehavior method to dynamically attach behavior to an object.
This property is read-only for Currentstyle objects. is writable for other objects.
It is important to note that using the Behavior property of the style sheet (CSS) to inline definitions or to use the Addbehavior method to attach the behavior is automatically detached when the object is removed from the document tree. The behavior defined by a style sheet rule in a document is automatically detached when the object is removed from the document tree.
The corresponding script attribute is behavior.

Example:

P {behavior:url (#default #download);}
div {behavior:url (fly.htc) URL (shy.htc);}
div {behavior:url (#myObject);}


Application 1: Refresh also retains the text in the input box

. shistory {}{behavior:url (#default #savehistory);}


Application 2: Calling the script

<style>
H1 {Behavior:url (BEHAVE.HTC)}
</style>
<body>
</body>
Behave.htc

<component>
<attach for= "element" event= "onmouseover" handler= "Hig_lite"/>
<attach for= "element" event= "onmouseout" handler= "Low_lite"/>
<script type= "Text/javascript" >
function Hig_lite ()
{
lor=255
}
function Low_lite ()
{
Lor=0
}
</script>
</component>

  
Note: CSS when try to avoid the use of behaviors technology

Internet Explorer Behaviors
What is it? Internet Explorer 5 introduces behavior (behaviors). Behaviors is a way to add behavior to HTML elements by using CSS.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.