onclik后js里的function跳转到一个php里执行查询。这有意义吗?

解决方案 »

  1.   

    使用XMLHTTP方法
    <script>
    function getMsg()
    {
        var xml = new ActiveXObject("Microsoft.XMLHTTP");
        xml.open("GET","test.php?id=1",false);
        xml.send();
        document.all.msg.innerText = xml.responseText;
    }
    </script>
    <p id=msg></p>
    <input type='radio' onclick='getMsg()'>
    -------------------------
    test.php
    <?
        if (isset($_GET['id']))
        {
           $res =mysql_query("select * from table where id = '".$_GET['id']."'";
           $arr = mysql_fetch_array($res);
           header("Content-Type:text/html;charset=GB2312");
           print_r($arr);
        }
    ?>
      

  2.   

    噢,看来全世界99%的客户端都装了microsoft的xml包。
      

  3.   

    <script language="javascript">
    function gogo()
    {
    location.href="next.html";//指向下一个页面
    }
    </script><input type='radio' onclick='gogo()'>