DOM Example: setStyle : DOM Utilities « Ajax Layer « JavaScript DHTML

Home
JavaScript DHTML
1.Ajax Layer
2.Data Type
3.Date Time
4.Development
5.Document
6.Dojo toolkit
7.Event
8.Event onMethod
9.Ext JS
10.Form Control
11.GUI Components
12.HTML
13.Javascript Collections
14.Javascript Objects
15.Javascript Properties
16.jQuery
17.Language Basics
18.Mochkit
19.Mootools
20.Node Operation
21.Object Oriented
22.Page Components
23.Rico
24.Scriptaculous
25.Security
26.SmartClient
27.Style Layout
28.Table
29.Utilities
30.Window Browser
31.YUI Library
JavaScript DHTML » Ajax Layer » DOM Utilities 
DOM Example: setStyle


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>DOM Example: setStyle</title>

<script type="text/javascript" src="./build/yahoo/yahoo.js"></script>
<script type="text/javascript" src="./build/event/event.js"></script>
<script type="text/javascript" src="./build/dom/dom.js"></script>

<script type="text/javascript">
YAHOO.namespace('example.dom');

YAHOO.example.dom.init = function() {

   var fade = function(e) {
      YAHOO.util.Dom.setStyle('fade', 'opacity', .5);
   };
   
   YAHOO.util.Event.addListener(document, 'click', fade);
};

YAHOO.util.Event.addListener(window, 'load', YAHOO.example.dom.init);
</script>

<link rel="stylesheet" type="text/css" href="./examples/dom/css/dom.css">
</head>

<body>
<div id="doc">
   <h1>DOM Example: setStyle</h1>
   <p>This example demonstrates how to use Dom.setStyle to set the opacity of an element.</p>
   <p>Click anywhere to set the element's opacity.</p>
   <div id="fade">Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat </div>
</div>


</body>
</html>

           
       
yui.zip( 3,714 k)
Related examples in the same category
1.Module Example
2.DOM Utilities: addClass
3.DOM Example: getElementsByClassName
4.DOM Example: getStyle
5.DOM Example: getXY
6.DOM Example: hasClass
7.DOM Example: removeClass
8.DOM Example: setXY
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.