source: cows/branches/cows-vis/cows/pylons/project_templates/cows_server/+package+/public/js/yui/examples/node/node-style.html @ 5259

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/cows/branches/cows-vis/cows/pylons/project_templates/cows_server/+package+/public/js/yui/examples/node/node-style.html@5259
Revision 5259, 11.8 KB checked in by domlowe, 11 years ago (diff)

adding yui javascript

Line 
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2<html>
3<head>
4        <title>YUI Library Examples: Node Utility: Node Styling</title>
5    <meta http-equiv="content-type" content="text/html; charset=utf-8">
6        <link rel="stylesheet" type="text/css" href="../../assets/yui.css" >
7
8<style>
9    /*Supplemental CSS for the YUI distribution*/
10    #custom-doc { width: 95%; min-width: 950px; }
11    #pagetitle {background-image: url(../../assets/bg_hd.gif);}
12    #pagetitle h1 {background-image: url(../../assets/title_h_bg.gif);}
13</style>
14
15<link rel="stylesheet" type="text/css" href="../../assets/dpSyntaxHighlighter.css">
16<link type="text/css" rel="stylesheet" href="../../build/cssfonts/fonts-min.css" />
17<script type="text/javascript" src="../../build/yui/yui-min.js"></script>
18<link href="assets//node.css" rel="stylesheet" type="text/css">
19
20</head>
21<body id="yahoo-com" class=" yui-skin-sam">
22<div id="custom-doc" class="yui-t2">
23<div id="hd">
24        <div id="ygunav">
25                <p>
26            <em>
27                <a href="http://developer.yahoo.com/yui/3/">YUI 3.x Home</a> <i> - </i> 
28            </em>
29                </p>
30                <form action="http://search.yahoo.com/search" id="sitesearchform">
31            <input name="vs" type="hidden" value="developer.yahoo.com">
32            <input name="vs" type="hidden" value="yuiblog.com">
33                    <div id="sitesearch">
34                        <label for="searchinput">Site Search (YDN &amp; YUIBlog): </label>
35                            <input type="text" id="searchinput" name="p">
36                            <input type="submit" value="Search" id="searchsubmit" class="ygbt">
37                    </div>
38                </form>
39    </div>
40        <div id="ygma"><a href="../../"><img src="../../assets/logo.gif"  border="0" width="200" height="93"></a></div>
41        <div id="pagetitle"><h1>YUI Library Examples: Node Utility: Node Styling</h1></div>
42</div>
43<div id="bd">
44
45        <div id="bar-note"><p><strong>Note:</strong> This is YUI 3.x. Looking for <a href="http://developer.yahoo.com/yui/">YUI 2.x</a>?</p></div>
46
47        <div id="yui-main">
48                <div class="yui-b">
49                  <div class="yui-ge">
50                          <div class="yui-u first example" id="main">
51
52        <h2>Node Utility: Node Styling</h2>
53
54        <div id="example" class="promo">
55        <p>
56        <p>This example shows how to style an element using Node.</p>
57
58        </p>   
59
60        <div class="module example-container ">
61                        <div class="hd exampleHd">
62                        <p class="newWindowButton yui-skin-sam">
63                <a href="node-style_clean.html" target="_blank">View example in new window.</a>
64            </p>
65                </div>          <div id="example-canvas" class="bd">
66
67               
68        <!--BEGIN SOURCE CODE FOR EXAMPLE =============================== -->
69       
70        <div id="demo">
71    <p>Click me to change my color and show some style information.</p>
72</div>
73
74
75<script type="text/javascript">
76YUI({base:"../../build/", timeout: 10000}).use("node-style", function(Y) {
77    var onClick = function(e) {
78        var node = e.currentTarget;
79        if (!node.query('dl')) { // only create the DL once
80            node.setStyle('color', 'green');
81            var styleColor = node.getStyle('color');
82            var computedColor = node.getComputedStyle('color');
83
84            node.appendChild(Y.Node.create('<dl>' +
85                '<dt>style.color</dt><dd>' + styleColor + '</dd>' + 
86                '<dt>computedStyle.color</dt><dd>' + computedColor + '</dd>' +
87            '</dl>'));
88        }
89    };
90
91    Y.get('#demo').on('click', onClick);
92});
93</script>
94       
95        <!--END SOURCE CODE FOR EXAMPLE =============================== -->
96       
97               
98                </div>
99        </div>                 
100        </div>
101               
102        <h3>Setting up the HTML</h3>
103<p>First we need some HTML to work with.</p>
104<textarea name="code" class="HTML">
105<div id="demo">
106    <p>Click me to change my color and show some style information.</p>
107</div>
108</textarea>
109
110<h3>Using Style Methods</h3>
111<p>In this example, we will set the node's color and compare the style and computedStyle values when our demo node is clicked.</p>
112<textarea name="code" class="JScript">
113var onClick = function(e) {
114    var node = e.currentTarget;
115    if (!node.query('dl')) { // only create the DL once
116        node.setStyle('color', 'green');
117        var styleColor = node.getStyle('color');
118        var computedColor = node.getComputedStyle('color');
119
120        node.appendChild(Y.Node.create('<dl>' +
121            '<dt>style.color</dt><dd>' + styleColor + '</dd>' +
122            '<dt>computedStyle.color</dt><dd>' + computedColor + '</dd>' +
123        '</dl>'));
124    }
125};
126</textarea>
127
128<p>The last step is to assign the click handler.</p>
129<textarea name="code" class="JScript">
130Y.get('#demo').on('click', onClick);
131</textarea>
132
133<h3>Full Script Source</h3>
134<textarea name="code" class="JScript">
135YUI().use('*', function(Y) {
136    var onClick = function(e) {
137        var node = e.currentTarget;
138        if (!node.query('dl')) { // only create the DL once
139            node.setStyle('color', 'green');
140            var styleColor = node.getStyle('color');
141            var computedColor = node.getComputedStyle('color');
142
143            node.appendChild(Y.Node.create('<dl>' +
144                '<dt>style.color</dt><dd>' + styleColor + '</dd>' +
145                '<dt>computedStyle.color</dt><dd>' + computedColor + '</dd>' +
146            '</dl>'));
147        }
148    };
149
150    Y.get('#demo').on('click', onClick);
151});
152</textarea>
153                                </div>
154                                <div class="yui-u sidebar">
155                                       
156                               
157                                        <div id="examples" class="mod box4">
158                        <div class="hd">
159                                                <h4>
160    Node Utility Examples:</h4>
161                        </div>
162                                                <div class="bd">
163                                                        <ul>
164                                                                <li><a href='../node/basic-node.html'>Node Basics</a></li><li><a href='../node/dom-node.html'>DOM Methods</a></li><li><a href='../node/event-node.html'>Node Events</a></li><li><a href='../node/nodelist.html'>NodeList</a></li><li><a href='../node/node-evt-delegation.html'>Delegating Node Events</a></li><li><a href='../node/node-screen.html'>Measuring the Window and Document</a></li><li><a href='../node/node-xy.html'>Node Positioning</a></li><li class='selected'><a href='../node/node-style.html'>Node Styling</a></li><li><a href='../attribute/attribute-getset.html'>Custom Getters, Setters and Validators (included with examples for Attribute Utility)</a></li>                                                 </ul>
165                                                </div>
166                                        </div>
167                                       
168                                        <div class="mod box4">
169                        <div class="hd">
170                                                <h4>More Node Utility Resources:</h4>
171                        </div>
172                        <div class="bd">
173                                                <ul>
174                                                        <!-- <li><a href="http://developer.yahoo.com/yui/node/">User's Guide</a> (external)</li> -->
175                                                <li><a href="../../api/module_node.html">API Documentation</a></li>
176</ul>
177                        </div>
178                                        </div>
179                          </div>
180                </div>
181               
182                </div>
183        </div>
184
185
186<div class="yui-b toc3" id="tocWrapper">
187<!-- TABLE OF CONTENTS -->
188<div id="toc">
189       
190<ul>
191<li class="sect first">YUI 3.x Project</li><li class="item"><a title="The Yahoo! User Interface (YUI) Library, 3.x Branch, " href="http://developer.yahoo.com/yui/3/">YUI 3 Web Site (external)</a></li><li class="item"><a title="Examples of every YUI utility and control in action" href="../../examples/">YUI 3 Examples</a></li><li class="item"><a title="Instantly searchable API documentation for the entire YUI library." href="../../api/">YUI 3 API Docs</a></li><li class="item"><a title="The YUI Library can be downloaded from SourceForge" href="http://sourceforge.net/projects/yui/">YUI 3 on Sourceforge (external)</a></li><li class="item"><a title="YUI is free and open, offered under a BSD license." href="http://developer.yahoo.com/yui/3/license.html">YUI License (external)</a></li><li class="sect">YUI 3 Core - Examples</li><li class="item"><a title="YUI (Global Prerequisite) - Functional Examples" href="../../examples/yui/index.html">YUI (Global Prerequisite)</a></li><li class="item"><a title="Event - Functional Examples" href="../../examples/event/index.html">Event</a></li><li class="selected "><a title="Node - Functional Examples" href="../../examples/node/index.html">Node</a></li><li class="sect">YUI 3 Component Infrastructure - Examples</li><li class="item"><a title="Attribute - Functional Examples" href="../../examples/attribute/index.html">Attribute</a></li><li class="item"><a title="Base - Functional Examples" href="../../examples/base/index.html">Base</a></li><li class="sect">YUI 3 Utilities - Examples</li><li class="item"><a title="Animation - Functional Examples" href="../../examples/anim/index.html">Animation</a></li><li class="item"><a title="Cookie - Functional Examples" href="../../examples/cookie/index.html">Cookie</a></li><li class="item"><a title="Drag &amp; Drop - Functional Examples" href="../../examples/dd/index.html">Drag &amp; Drop</a></li><li class="item"><a title="Get - Functional Examples" href="../../examples/get/index.html">Get</a></li><li class="item"><a title="IO - Functional Examples" href="../../examples/io/index.html">IO</a></li><li class="item"><a title="JSON (JavaScript Object Notation) - Functional Examples" href="../../examples/json/index.html">JSON</a></li><li class="item"><a title="Queue - Functional Examples" href="../../examples/queue/index.html">Queue</a></li><li class="sect">YUI 3 CSS - Examples</li><li class="item"><a title="YUI CSS Reset - Functional Examples" href="../../examples/cssreset/index.html">CSS Reset</a></li><li class="item"><a title="YUI Fonts - Functional Examples" href="../../examples/cssfonts/index.html">CSS Fonts</a></li><li class="item"><a title="YUI Grids - Functional Examples" href="../../examples/cssgrids/index.html">CSS Grids</a></li><li class="item"><a title="YUI Base - Functional Examples" href="../../examples/cssbase/index.html">CSS Base</a></li><li class="sect">The YUI Community</li><li class="item"><a title="The Yahoo! User Interface Blog" href="http://yuiblog.com">YUI Blog (external)</a></li><li class="item"><a title="The Yahoo! Group YDN-JavaScript hosts the YUI community forum" href="http://tech.groups.yahoo.com/group/ydn-javascript/">YUI Forum (external)</a></li><li class="item"><a title="The Yahoo! Group yui3 is dedicated to the 3.x branch of the Yahoo! User Interface (YUI) Library." href="http://tech.groups.yahoo.com/group/yui3/">YUI 3 Forum (external)</a></li><li class="item"><a title="YUI is used by Yahoo! and by hundreds of other sites, including many you know and love." href="/yui/poweredby/">YUI Sightings (external)</a></li><li class="item"><a title="Videos and podcasts from the YUI Team and from the Yahoo! frontend engineering community." href="http://developer.yahoo.com/yui/theater/">YUI Theater (external)</a></li><li class="sect">YUI Articles on the YUI Website</li><li class="item"><a title="Answers to Frequently Asked Questions about the YUI Library" href="http://developer.yahoo.com/yui/articles/faq/">YUI FAQ (external)</a></li><li class="item"><a title="Yahoo!'s philosophy of Graded Browser Support" href="http://developer.yahoo.com/yui/articles/gbs/">Graded Browser Support (external)</a></li><li class="item"><a title="Reporting Bugs and Making Feature Requests for YUI Components" href="http://developer.yahoo.com/yui/articles/reportingbugs/">Bug Reports/Feature Requests (external)</a></li><li class="item"><a title="Serve YUI source files from Yahoo! -- free, fast, and simple" href="http://developer.yahoo.com/yui/3/articles/hosting/">Serving YUI Files from Yahoo! (external)</a></li></ul>
192</div>
193</div>
194        </div><!--closes bd-->
195
196        <div id="ft">
197        <p class="first">Copyright &copy; 2008 Yahoo! Inc. All rights reserved.</p>
198        <p><a href="http://privacy.yahoo.com/privacy/us/devel/index.html">Privacy Policy</a> -
199            <a href="http://docs.yahoo.com/info/terms/">Terms of Service</a> -
200            <a href="http://docs.yahoo.com/info/copyright/copyright.html">Copyright Policy</a> -
201            <a href="http://careers.yahoo.com/">Job Openings</a></p>
202        </div>
203</div>
204<script src="../../assets/dpSyntaxHighlighter.js"></script>
205<script language="javascript"> 
206dp.SyntaxHighlighter.HighlightAll('code'); 
207</script>
208</body>
209</html>
210<!-- delightfuture.corp.yahoo.com uncompressed/chunked Wed Aug 13 16:45:33 PDT 2008 -->
Note: See TracBrowser for help on using the repository browser.