Ryan's District
November 22, 2008, 01:42:38 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Ryan's District Lottery: Claim your ticket or check
Jackpot details  
 
   Home   Help Search Chat Calendar Chess Shop Login Register  
Digg This!
Pages: [1]   Go Down
  Send this topic  |  Print  
Author Topic: XML DHTML Behaviors  (Read 4039 times)
0 Members and 1 Guest are viewing this topic.
ben2ong2
Quality Poster
Paid
Hero Member
*****

Reputation: 17
Offline Offline

Gender: Male
Posts: 2374
9976.80 RD$

View Inventory
Send Money to ben2ong2

View Profile Awards
« on: October 06, 2006, 03:43:21 PM »

Internet Explorer 5 introduced DHTML behaviors. Behaviors are a way to add DHTML functionality to HTML elements with the ease of CSS.
 
Behaviors - What are They?
IE5 introduced DHTML behaviors. Behaviors are a way to add DHTML functionality to HTML elements with the ease of CSS.
How do behaviors work? By using XML we can link behaviors to any element in a web page and manipulate that element.
DHTML behaviors do not use a <script> tag. Instead, they are using a CSS attribute called "behavior". This "behavior" specifies a URL to an HTC file which contains the actual behavior (The HTC file is written in XML).
Syntax
behavior: url(some_filename.htc)
Note: The behavior attribute is only supported by IE 5 and higher, all other browsers will ignore it. This means that Mozilla, Firefox, Netscape and other browsers will only see the regular content and IE 5+ can see the DHTML behaviors.
 
Example
The following HTML file has a <style> element that defines a behavior for the <h1> element:
<html><head><style type="text/css">h1 { behavior: url(behave.htc) }</style></head><body><h1>Mouse over me!!!</h1></body></html>
The XML document "behave.htc" is shown below:
<attach for="element" event="onmouseover" handler="hig_lite" /><attach for="element" event="onmouseout" handler="low_lite" /><script type="text/javascript">function hig_lite(){element.style.color='red'}function low_lite(){element.style.color='blue'}</script>
The behavior file contains a JavaScript and the event handlers for the script.
Try it yourself (mouse over the text in the example).
The following HTML file has a <style> element that defines a behavior for elements with an id of "typing":
<html><head><style type="text/css">#typing{behavior:url(typing.htc);font-family:'courier new';}</style></head><body><span id="typing" speed="100">IE5 introduced DHTML behaviors.Behaviors are a way to add DHTML functionality to HTML elementswith the ease of CSS.

How do behaviors work?
By using XML we can link behaviors to any element in a web pageand manipulate that element.</p></span></body></html>
The XML document "typing.htc" is shown below:
<attach for="window" event="onload" handler="beginTyping" /><method name="type" /><script type="text/javascript">var i,text1,text2,textLength,tfunction beginTyping(){i=0text1=element.innerTexttextLength=text1.lengthelement.innerText=""text2=""t=window.setInterval(element.id+".type()",speed)}function type(){text2=text2+text1.substring(i,i+1)element.innerText=text2i=i+1if (i==textLength){clearInterval(t)}}</script>
Logged

You are not allowed to view links.
Register or Login
Free Paid Survey & Home Business Resources.

You are not allowed to view links.
Register or Login
Free Article Directory | Quality Content
Ryan's District
« on: October 06, 2006, 03:43:21 PM »

 Logged
Pages: [1]   Go Up
  Send this topic  |  Print  
 
Jump to:  

Archive - WAP2 - WAP - imode
Sponsors: RAYAN.tv
-

Powered by MySQL Powered by PHP Powered by SMF 1.1.7 | SMF © 2006-2008, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 3.012 seconds with 31 queries.

Google visited last this page November 19, 2008, 08:48:16 AM