海军资料

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

<script type="text/javascript">
function win1()
{
  var win = new Window({className: "alphacube", title: "Sample", width:250, height:150, top:0, left: 1, parent:$('container')});
  win.getContent().innerHTML = "<h1>Constraint inside  a div !!</h1>constraint: {left:10, right:20}";

  win.setDestroyOnClose();
  win.show();
  win.setConstraint(true, {left:10, right:20})
  win.toFront();
}

function win2()
{
  var win = new Window({className: "alphacube", title: "Sample", width:200, height:150});
  win.getContent().innerHTML = "<h1>Constraint inside page !!</h1>constraint: {top: 30, bottom:10}";

  win.setDestroyOnClose();
  win.showCenter();
  win.setConstraint(true, {left:0, right:0, top: 30, bottom:10})
  win.toFront();
}

function win3()
{
  var win = new Window({className: "alphacube", title: "Sample", width:250, height:150, wiredDrag: true});
  win.getContent().innerHTML = "<h1>No Constraint</h1>Wired mode";
  win.setDestroyOnClose();
  win.setLocation(10, 500);
  win.show();
  win.toFront();
}

</script>
<style>
body {
  background: #FFCA7A;
}
#border {
  position:absolute;
  top:10px;
  left:10px;
  width:500px;
  height:500px;
  border: 1px solid #000;
  overflow:hidden;

#container {
  position:absolute;
  top:0px;
  left:0px;
  width:500px;
  height:500px;
  overflow:hidden;
  background:#71BAB8;
  z-index:0;

</style>
</head>
<body>

<div id="border">
  <div id="container"></div>
</div>

<script>
  win1();
  win2();
  win3();
</script>
</body></html>
效果如下图:

posted on 2007-04-19 08:42  周海军  阅读(397)  评论(0编辑  收藏  举报