想在加载页面的时候先访问一个php页面,执行里面的代码,这个用js如何做到?

解决方案 »

  1.   

    window.onload = function(){
        window.location= "php页面地址";
    };
      

  2.   

    <script type="text/javascript">
    with (new XMLHttpRequest()) {
        open("GET", "xxxxx.php", false);
        send(null);
    }
    </script>
      

  3.   

     楼上的with什么意思 如何加载页面的时候执行呢?
      

  4.   


    把它写在window.onload = function(){}
      

  5.   


    <script type="text/javascript"> 
    window.onload = function()

       with (new XMLHttpRequest())
          { 
            open("GET", "xxxxx.php", false); 
            send(null); 
          } 
    }
    </script>