虚拟主机中的网站默认首页是index.html,现改版,想一打开网站就转到main.asp这页,请问如何在index.html写代码,当打开index.html这页时,直接转到main.asp这页面,多谢!

解决方案 »

  1.   

    <script>
    window.location = 'main.aspx'
    <script>
      

  2.   

    在index.html的body中加入一段js脚本
    window.location.href
      

  3.   

    <head><script>
    document.location="main.asp";
    </script></head>
      

  4.   

    main.aspx和index.aspx是同一目录吗?
      

  5.   

    刚那么复杂做什么?
    把Main.aspx 改成 Index.aspx 不就行了
      

  6.   

    <script type="text/javascript">
           window.setTimeout("window.location.href='你要跳转的地址的url';",10);
    </script>
      

  7.   

    index.asp 不行吗?一定要改成 Index.aspx ?
      

  8.   

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title></title>    <script type="text/javascript">
            var second = 3;
    function leaveTo()
    {
    window.open("Login.aspx","_parent","replace");
    }
    function SetSecond()
    {
        second = second - 1;
        document.getElementById("second").innerHTML = second;
        setTimeout("SetSecond()","1000");
        if (second == 0)
        {
            leaveTo();
        }
    }
        </script></head>
    <body style="font-size:14px;">
        <div>系统将在<label id="second" style="color:Red">3</label>秒后返回登录页面...................点击<a href="Login.aspx"
            target="_parent">这里</a>重新登录</div>
            <script type="text/javascript">
                SetSecond();
    </script>
    </body>
    </html>
      

  9.   

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head>
        <title>无标题页</title>
        <script type="text/javascript">
        //window.setTimeout("window.location.href='http://www.baidu.com'",10);
        window.location.href='http://www.google.com';    
        </script>
    </head>
    <body></body>
    </html>
      

  10.   

    window.onload=function()
    {
      window.location='......';
    }
      

  11.   

    服务器配置的时候一般都是默认打开index.html  index.asp index.aspx这样下去的 所以直接吧main.asp名称改成index.asp然后把index.html改成其他的名字
      

  12.   

    <HTML> 
    <HEAD> 
    <TITLE>WELCOME</TITLE> 
    <meta http-equiv="Refresh" content="3; url=http://www.baidu.com"> 
    </HEAD>
    <BODY><img SRC="welcome.gif" ></BODY> 
    </HTML>
      

  13.   

    这个通过了,就是我想要的,非常感谢!
    就用以下三行就OK了.呵...
     <script type="text/javascript">
       window.location.href='http://www.google.com';    
     </script>
      

  14.   

    <meta http-equiv="Refresh" content="3; url=main.asp">  或者iis上配置下
      

  15.   

    原来后面的<script>少了个"/",其实也是OK的!