delegateの内容を取得する

書式

 windowObj.getDelegate()

windowObj : ウィンドウオブジェクト

説明

 delegateの内容を取得するにはgetDelegate()を使います。実際の処理はcanCloseメソッドに記述されています。

サンプルコード [実行]

<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>Sample</title>
<link rel="stylesheet" href="default.css" type="text/css" media="all">
<script type="text/javascript" src="prototype.js"></script>
<script type="text/javascript" src="effects.js"></script>
<script type="text/javascript" src="window.js"></script>
<script type="text/javascript"><!--
var win;
window.onload = function(){
win = new Window("win01", {
title: "ウィンドウ", className: "dialog",
top:150, left:10, width:320, height:240,
zIndex: 100, resizable: true, draggable:true });
win.setDestroyOnClose();
win.setDelegate(new allClose);
win.show();
}
function allClose(){
this.canClose = function(){
win.destroy();
alert("ウィンドウを閉じます");
}
}
function check(){
$("result").innerHTML = win.getDelegate().canClose;
}
// --></script>
</head>
<body>
<h1>delegateの内容を取得</h1>
<form>
<input type="button" value="取得" onClick="check()">
</form>
<div id="result"></div>
</body>
</html>