55、对层内容的控制

55、对层内容的控制

脚本说明:

第一步:把如下代码加入<body>区域中

<style type="text/css"> DIV.qlabel { font-size: 14pt; font-weight: bold; text-align: center; } </style>

<script language="JavaScript" src="20030818control.js"></script>

 

<script language="JavaScript" src="20030818wndctrl.js"></script>

 

<script language="JavaScript" src="20030818boxctrl.js"></script>

 

<script language="JavaScript" src="20030818messagebox.js"></script>

 

<script language="JavaScript" src="20030818label.js"></script>

 

<script language="JavaScript" src="20030818button.js"></script>

 

<script language="JavaScript" src="20030818buttonres.js"></script>

 

<script language="JavaScript" src="20030818boxres.js"></script>

    <div class="code">

<script language="JavaScript">

 

      // define box resource

 

      box = new QBoxRes(13, 13, 13, 13,

 

          "20030818/wtc.gif", "20030818/wtr.gif", "20030818/wmr.gif",

 

          "20030818/wbr.gif", "20030818/wbc.gif", "20030818/wbl.gif",

 

          "20030818/wml.gif", "20030818/wtl.gif",

 

          "#FFE831", "20030818/wbg.gif",

 

          QWndCtrl.SHADOW + QWndCtrl.FADEIN + QWndCtrl.HBARNOUT);

 

 

 

      // define button resource

 

      btn = new QButtonRes(QButton.NORMAL, 46, 29,

 

          "20030818/btn2n.gif", "20030818/btn2p.gif");

 

 

 

      // create box

 

      mb = new QMessageBox(null, "mb", box, btn, "Test");

 

    </script></div>

 

    <div class="cases">

      <a href="#" onClick="mb.alert('Test');return false">警告: Test</a> 

 

      <a href="#" onClick="mb.alert('Hello, World!');return false">警告: Hello, World!</a> 

 

      <a href="#" onClick="mb.center();return false">居中</a> 

 

      <a href="#" onClick="mb.show(!mb.visible);return false">显示/隐藏</a> 

 

      <a href="#" onClick="mb.moveTo(mb.x + 5, mb.y + 10);return false">移动</a> 

 

      <a href="#" onClick="mb.setOpacity(mb.opacity - 10 || 100);return false">改变颜色</a> 

 

      <a href="#" onClick="mb.setEffects(mb.effects ^ QWndCtrl.SHADOW);return false">加减阴影</a>

 

    </div>

 

 

 

第二步:把<body>中的内容改为:

<BODY class="content" onload="self.mb.alert()">

 

Write a comment

Comments: 0