posts - 0,  comments - 5,  trackbacks - 0
          <html>??
          <head>??
          <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />??
          <title>右下角彈出提示</title>
          <SCRIPT LANGUAGE="JavaScript">
          <!--
          ?//定義XMLHttp實例??
          var xmlHttp;??
          function createXMLHttpRequest(){??
          //開始初始化XMLHttpRequest對象??
          ? if(window.ActiveXObject){??
          //IE瀏覽器??
          ??? xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");??
          ? }else if(window.XMLHttpRequest){??
          //Mozilla瀏覽器??
          ??? xmlHttp = new XMLHttpRequest();??
          ? }??
          if(xmlHttp){??
          ??? //設置請求地址??
          ??? xmlHttp.open("GET","/test/prompt.xml",true);??
          ??? xmlHttp.onreadystatechange=setState;//設置回調函數??
          ??? xmlHttp.send(null);??
          ? }??
          }??
          //回調函數??
          function setState(){??
          ? if(xmlHttp.readyState == 4){??
          ??? if(xmlHttp.status == 200){??
          ??????? parseResults(xmlHttp.responseXML)??
          ??? }??
          ? }??
          }???
          /*處理XML*/?
          function parseResults(xmlDOM) {??
          try{??
          var root = xmlDOM.documentElement;???
          var info = root.getElementsByTagName('message');??
          var out? = "";??
          var message = null;??
          var current = null;??
          ?????? for(var i=0;i<info.length;i++){??
          ??????????? message = info[i];??
          ??????????????????????? id??? = message.getElementsByTagName("id")[0].firstChild.data;??
          ??????????????????????? title = message.getElementsByTagName("title")[0].firstChild.data;??
          ????????????? out=out+(i+1)+"."+"<a style=\"font-size:12px; color: #6D93C8; face: Tahoma\" title='內容提要:\n"?
          ????????????? +title??
          ????????????? +"\n時間:"?
          ????????????? +title??
          ????????????? +"'"+" href=# >"?
          ????????????? +title??
          ????????????? +"</a><BR>";??
          ?????????? }???
          ????? popmsg("<BR>"+out);??
          ? }catch(exception){??
          ?//???? alert("出錯了!");??
          ??? }???
          }??
          ?
          /*右下角提示框*/?
          var oPopup = window.createPopup();??
          var popTop=50;??
          function popshow(){??
          oPopup.show(screen.width-250,screen.height-popTop,241,172);??
          }??
          function pophide(){??
          oPopup.hide();??
          }??
          function popmsg(msgstr){??
          ?
          ??? var winstr="<table? valign=\"top\" style=\"border: 1 solid #6D93C8\" width=\"241\" height=\"172\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" >";??
          ??? winstr+="<tr><td bgcolor=\"#BCCCDF\" onClick=\"parent.pophide();\" valign=\"top\" align=\"center\"? height=\"20\" style=\"font-size:14px; color: #6D93C8; face: Tahoma;filter:Blur(add=1,direction=45,strength=8) \">你有新短消息:</td></tr><tr><td valign=\"top\" align=\"center\"><table valign=\"top\" width=\"90%\" height=\"110\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">";??
          ??? winstr+="<tr><td valign=\"top\" style=\"font-size:12px; color: #6D93C8; face: Tahoma\">"+msgstr+"</td></tr></table></td></tr></table>";??
          ??????
          ??? oPopup.document.body.innerHTML = winstr;??
          ??? popshow();??
          ??? setInterval('window.focus()',0); //讓IE重獲取焦點???
          ??????
          }??
          ?
          /*提示間隔時間*/?
          var secs=5;//第一次提示時間秒??
          ??? function checkServer(secs){??
          ??? for(i=1;i<=secs;i++) {??
          ???? window.setTimeout("update(" + i + ")", i * 1000);??
          ??? }??
          ??? }??
          ??? function update(num) {??
          ???? if(num == secs) {??
          ????? createXMLHttpRequest();??
          ????? secs=1*60;//提示時間秒??
          ????? for(i=1;i<=secs;i++) {??
          ???? window.setTimeout("update(" + i + ")", i * 1000);??
          ??? }??
          ???? }??
          ??? else {??
          ???? printnr = secs-num;??
          ???? }??
          ??? }??
          checkServer(secs);
          //-->
          </SCRIPT>
          </head>??
          <body>??
          <input type="button" onclick="createXMLHttpRequest()" value="測試請求" />??
          <div id="contain"></div>??
          </body>??
          </html>
          posted on 2008-06-13 20:22 crazy 閱讀(95) 評論(0)  編輯  收藏 所屬分類: ajax

          只有注冊用戶登錄后才能發(fā)表評論。


          網站導航:
           
          主站蜘蛛池模板: 长岛县| 铁岭县| 黄平县| 漯河市| 林甸县| 体育| 余庆县| 定州市| 鲁山县| 南投县| 瑞金市| 长顺县| 抚顺市| 谷城县| 同德县| 和顺县| 永泰县| 沂南县| 乐陵市| 茶陵县| 五河县| 西平县| 巨鹿县| 瑞丽市| 福鼎市| 奈曼旗| 连州市| 秦皇岛市| 泗洪县| 凤翔县| 扎鲁特旗| 洪洞县| 荔浦县| 东城区| 孝感市| 红原县| 山阳县| 视频| 杭锦后旗| 海伦市| 临江市|