<!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> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
<title>无标题文档 </title> 
</head> 
<body onload="document.getElementById('sina').click()"> 
<a id="sina" href="http://www.sina.com.cn">新浪网 </a> 
</body> 
</html> 

解决方案 »

  1.   

    yangqidong ,火狐下不行的。
      

  2.   


    <!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> 
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
    <title>无标题文档 </title> 
    </head> 
    <body onload="document.getElementById('sina').submit()"> 
    <form id="sina" action="http://www.sina.com.cn" method="get">
    </form>
    <a id="sina" href="http://www.sina.com.cn">新浪网 </a> 
    </body> 
    </html> 
      

  3.   

    找到一段这样的代码,不知如何应用?
    HTMLElement.prototype.click = function() {
    var evt = this.ownerDocument.createEvent('MouseEvents');
    evt.initMouseEvent('click', true, true, this.ownerDocument.defaultView, 1, 0, 0, 0, 0, false, false, false, false, 0, null);
    this.dispatchEvent(evt);
    }
      

  4.   

    用原型声明HTMLElement 类的click方法
      

  5.   

    <html> 
    <META HTTP-EQUIV="Refresh" CONTENT="0; URL=http://www.sina.com.cn"><!--这个是页面自动刷新-->
    <head> 
    <title>无标题文档 </title> 
    </head> 
    <body > 
    </body> 
    </html> <html> 
    <head> 
    <title>无标题文档 </title> 
    </head> 
    <script language="javascript">
    <!--
    function jump(){
    location.replace("http://www.sina.com.cn");//用页面重定向
    //document.getElementById("sina").fireEvent("onclick");//用事件触发是这样来做,但不起作用
    }
    -->
    </script>
    <body onload="jump()"> 
    <a id="sina" href="http://www.sina.com.cn">新浪网 </a> 
    </body> 
    </html>