• λ我爱Aspx >> C#.Net >> Javascript利用xmlhttp获得服务器时钟的方法_ASP技巧
  • Javascript利用xmlhttp获得服务器时钟的方法_ASP技巧

  • :aspxer  Դ:internet  :2007-4-28 23:47:07  ؼ:asp,xml,javascript
  • <table width="98%"><tr>

    <td align="center" width="50%" style="font-size:16;font-weight:bold;">长春轨道客车股份有限公司产品计划价格计算程序</td>

    <td width="50%" align="right">

    <input type="text" style="font-size:12px;border:none;background:;" size="18" id="myTime" />

    </td>

    </tr>

    </table>

    </body>

    </html>

    <script>

    //复杂方法,添加了很多检测,和错误处理

    var xmlhttp,alerted

    try {

    xmlhttp=new ActiveXObject("Msxml2.XMLHTTP")

    } catch (e) {

    try {

    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")

    } catch (E) {

    alert("请安装Microsofts XML parsers")

    }

    }

    if (!xmlhttp && !alerted) {

    try {

    xmlhttp = new XMLHttpRequest();

    } catch (e) {

    alert("你的浏览器不支持XMLHttpRequest对象,请升级");

    }

    }

    function getClock()

    {

    if (xmlhttp) {

    xmlhttp.Open("Get","clock.asp",true);

    xmlhttp.onreadystatechange=RSchange;

    xmlhttp.send();

    }

    }

    setInterval( "getClock()", 1000 );

    function RSchange()

    {

    if (xmlhttp.readyState==4) {

    myTime.value = xmlhttp.responseText;

    }

    }

    </script>

    Ҷƪл˵?
  • һƪ解读 C# 中的正则表达式
    һƪXMLHttpRequest和AJAX虎视Web应用开发_Ajax