表示位置を指定する

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="ja">
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>Sample</title>
<link rel="stylesheet" href="css/default.css" type="text/css" media="all">
<link rel="stylesheet" href="css/main.css" type="text/css" media="all">
<script type="text/javascript" src="js/prototype.js" charset="shift_jis"></script>
<script type="text/javascript" src="js/effects.js" charset="shift_jis"></script>
<script type="text/javascript" src="js/window.js" charset="shift_jis"></script>
<script type="text/javascript"><!--
var win;
function openWin(){
win = new Window("win01", {
title: "Sample",
className: "dialog",
top:150,
left:80,
zIndex: 100
});
win.setDestroyOnClose();
win.show();
}
function setPos(){
var x = Math.floor(Math.random()* 400);
var y = Math.floor(Math.random() * 200) + 80;
if (win) win.setLocation(y, x);
}
// --></script>
</head>
<body>
<h1>ウィンドウの表示位置を指定する</h1>
<form method="get" action="./win.cgi">
<input type="button" value="ウィンドウを開く" onClick="openWin()">
<input type="button" value="位置を変更する" onClick="setPos()">
</form>
</body>
</html>
サンプルを実行
[戻る]
prototype.jsパーフェクトリファレンス説明などは本書を参考にしてください。