webgui/www/extras/yui/examples/container/simpledialog/solution.html
2007-07-05 04:23:55 +00:00

70 lines
No EOL
2.6 KiB
HTML

<!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">
<link type="text/css" rel="stylesheet" href="../../../build/fonts/fonts.css">
<link type="text/css" rel="stylesheet" href="../../../build/reset/reset.css">
<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" src="../../../build/dragdrop/dragdrop.js" ></script>
<script type="text/javascript" src="../../../build/connection/connection.js" ></script>
<script type="text/javascript" src="../../../build/container/container.js"></script>
<link type="text/css" rel="stylesheet" href="../../../build/container/assets/container.css">
<style>
body { background:#eee }
.clear { clear:both; }
</style>
<script>
YAHOO.namespace("example.container");
function init() {
// Define various event handlers for Dialog
var handleYes = function() {
alert("You clicked yes!");
this.hide();
};
var handleNo = function() {
this.hide();
};
// Instantiate the Dialog
YAHOO.example.container.simpledialog1 = new YAHOO.widget.SimpleDialog("simpledialog1",
{ width: "300px",
fixedcenter: true,
visible: false,
draggable: false,
close: true,
text: "Do you want to continue?",
icon: YAHOO.widget.SimpleDialog.ICON_HELP,
constraintoviewport: true,
buttons: [ { text:"Yes", handler:handleYes, isDefault:true },
{ text:"No", handler:handleNo } ]
} );
YAHOO.example.container.simpledialog1.setHeader("Are you sure?");
// Render the Dialog
YAHOO.example.container.simpledialog1.render(document.body);
YAHOO.util.Event.addListener("show", "click", YAHOO.example.container.simpledialog1.show, YAHOO.example.container.simpledialog1, true);
YAHOO.util.Event.addListener("hide", "click", YAHOO.example.container.simpledialog1.hide, YAHOO.example.container.simpledialog1, true);
}
YAHOO.util.Event.addListener(window, "load", init);
</script>
</head>
<body>
<div>
<button id="show">Show simpledialog1</button>
<button id="hide">Hide simpledialog1</button>
</div>
</body>
</html>