<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Standard Module Support</title>
<style type="text/css">
/*margin and padding on body element
can introduce errors in determining
element position and are not recommended;
we turn them off as a foundation for YUI
CSS treatments. */
body {
margin:0;
padding:0;
}
</style>
<link type="text/css" rel="stylesheet" href="../../build/cssfonts/fonts-min.css" />
<script type="text/javascript" src="../../build/yui/yui-min.js"></script>
<!--begin custom header content for this example-->
<style type="text/css">
/* Overlay Look/Feel */
.yui-overlay-content {
padding:3px;
border:1px solid #000;
background-color:#aaa;
}
.yui-overlay-content .yui-widget-hd {
padding:5px;
border:2px solid #aa0000;
background-color:#fff;
}
.yui-overlay-content .yui-widget-bd {
padding:5px;
border:2px solid #0000aa;
background-color:#fff;
}
.yui-overlay-content .yui-widget-ft {
padding:5px;
border:2px solid #00aa00;
background-color:#fff;
}
/* Example Layout CSS */
.overlay-example {
border:1px solid #000;
background-color:#eee;
padding:5px;
zoom:1;
}
.overlay-example .fields {
float:left;
width:20em;
}
.overlay-example label {
display:block;
font-weight:bold;
margin-bottom:3px
}
.overlay-example select {
width:19em;
}
.overlay-example textarea {
width:19em;
height:15em;
}
.overlay-example .filler {
margin-left:21em;
margin-top:1em;
color:#999;
}
.overlay-example:after {
content:".";
display:block;
height:0;
clear:both;
}
</style>
<!--end custom header content for this example-->
</head>
<body class=" yui-skin-sam">
<h1>Standard Module Support</h1>
<div class="exampleIntro">
<p>This example shows how you can work either the <code>headerContent, bodyContent, footerContent</code> attributes, to replace content in the Overlay's standard module sections, or use the <code>setStdModContent(section, content, where)</code> method to insert content <em>before</em>, or append it <em>after</em> existing content in the section.</p>
</div>
<!--BEGIN SOURCE CODE FOR EXAMPLE =============================== -->
<div class="overlay-example" id="overlay-stdmod">
<div id="overlay">
<div class="yui-widget-hd">Overlay Header</div>
<div class="yui-widget-bd">Overlay Body</div>
<div class="yui-widget-ft">Overlay Footer</div>
</div>
<div class="fields">
<p>
<label for="content">New content:</label>
<textarea name="content" id="content"></textarea>
</p>
<p>
<label for="section">Section to add content to:</label>
<select name="section" id="section">
<option value="header">Header</option>
<option value="body">Body</option>
<option value="footer">Footer</option>
</select>
</p>
<p>
<label for="where">Replace, insert before or append after existing content:</label>
<select name="where" id="where">
<option value="before">Before</option>
<option value="after">After</option>
<option value="replace">Replace</option>
</select>
</p>
<p>
<label>Set new content as a string: <input type="checkbox" name="asString" id="asString" checked="true"></label>
</p>
<button type="button" id="setContent">Set Content</button>
</div>
<div class="filler">
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Sed tellus pede, aliquet vitae, faucibus quis, lobortis non, metus. Pellentesque at metus ac mi condimentum egestas. In vel neque a massa porttitor ultrices. Nunc lorem. Vivamus ullamcorper fringilla tortor. Etiam at nunc pellentesque lectus cursus pretium. Integer velit. In quis nunc eget leo rhoncus scelerisque. In in ante ac ante pharetra vestibulum. Praesent sit amet metus. Nam egestas ipsum. Nulla facilisi. Quisque rhoncus, eros sed convallis faucibus, erat felis pretium nisi, non bibendum magna mauris non metus. Integer mauris eros, volutpat non, pretium vitae, rutrum at, tellus.
</div>
</div>
<script type="text/javascript">
YUI({base:"../../build/", timeout: 10000}).use("overlay", function(Y) {
var overlay = new Y.Overlay({
contentBox:"#overlay",
width:"20em",
align: {
node:"#overlay-stdmod > .filler",
points:["tl", "tl"]
}
});
overlay.render();
var content = Y.one("#content");
var where = Y.one("#where");
var section = Y.one("#section");
var asString = Y.one("#asString");
Y.on("click", function() {
var newContent = content.get("value");
if (! asString.get("checked") ) {
// Set new content using Node references
newContent = Y.Node.create(newContent);
}
overlay.setStdModContent(section.get("value"), newContent, where.get("value"));
}, "#setContent");
});
</script>
<!--END SOURCE CODE FOR EXAMPLE =============================== -->
</body>
</html>