右下角弹出框

html(主页面)代码:

<div id="rbbox">
  <a class="button" οnclick="closeBox()">关闭</a>
  <iframe id="iframeyxj" src="yxjiframe.html" frameborder="0" height="150" width="180" scrolling="no"></iframe>
</div>

********************************

html(弹出的框)代码:

<body>
   <table>
    <tr>
     <td> 系统消息:</td>
    </tr>
    <tr>
     <td></td>
     <td><span style="font-size: 13px;color: red;">你好!</span></td>
    </tr>
   </table>  
  </body>

********************************

js代码:

//每5秒请求一次服务器
window.οnlοad=function(){
 window.setInterval("CheckIsNewSystemInfo()",5000);
}

function CheckIsNewSystemInfo()

 var sync=true;
 var req = window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
 req.open('POST','yxjMessage.action?id=iop',sync);
 req.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8');  
 req.send("");
 req.onReadyStateChange=function(){
  if(req.readyState==4){
   if(req.responseText.length>0){
    var obj=eval(req.responseText);   
    if(obj=="ok")
    {
     ifmessage(obj);
    }
   }
  }
 }
 
/*
 $.ajax({
  type:"POST",
  url:"yxjMessage.action",
  data:"name=lop",
  success:function(msg){
   alert(mag[0]);
   //ifmessage(msg[0]);
  }
 });
 */ 
}

function ifmessage(msg)
{
 showBox();
}

function showBox(o){
  
        if (o==undefined) o=document.getElementById("rbbox"); 
        o.style.height=150;
        if(o.style.display==="none")
        {
         o.style.display="block";
        }

function closeBox(){
   var rbbox = document.getElementById("rbbox");
         document.getElementById("rbbox").style.display="none";

*****************************************************

后台(webwork):

public String execute() throws Exception {
  PrintWriter pwriter = response.getWriter();
  response.setContentType("text/xml");  
  response.setHeader("Cache-Control", "no-cache");
  JSONArray json = new JSONArray();
  List list = new ArrayList();
  list.add("ok");
  pwriter.write(json.fromObject(list).toString());
  pwriter.flush();
  pwriter.close();
  return null;
 }

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值