我现在只要设为首页的提示对话框,加在这句话后能运行就可以:
if (!hp.isHomePage('http://abc.com/index.htm')) 
帮帮我啦》

解决方案 »

  1.   

    <html>
    <body>
    <span id=oHomePage style="behavior:url(#default#homepage);display:none"></span>
    <script>
    if (!oHomePage.isHomePage('http://abc.com/index.htm')) {
         oHomePage.setHomePage('http://abc.com/inde.htm');
    }</script>
    </body>
    </html>
      

  2.   

    Note:
    The isHomePage method returns a boolean.
    It will always return false if the argument is a file on another domain.
      

  3.   

    以下代碼測試通過
    <html>
    <body>
    <span id=hp style="behavior:url(#default#homepage)"></span>
    <script>if (!hp.isHomePage('http://abc.com/index.htm')) 
    {document.write("<p><a href=\"/index.htm\" id=\"n1\" onClick=\"style.behavior='url(#default#homepage)';setHomePage('http://abc.com/inde.htm');\">设为首页!</a>");
    document.getElementById("n1").click();
    }</script></body>
    </html>
      

  4.   

    <html>
    <body>
    <span id=oHomePage style="behavior:url(#default#homepage);display:none"></span>
    <script language="javascript">
    if (!oHomePage.isHomePage('http://www.csdn.net')) {
         oHomePage.setHomePage('http://www.csdn.net');
    }</script>
    </body>
    </html>
      

  5.   

    还有一个问题,比如我的域名是:csdn.net和www.csdn.net
    下面这句我这样写
    if (!oHomePage.isHomePage('http://www.csdn.net')) {
         oHomePage.setHomePage('http://www.csdn.net');}
    当把主页设为'http://www.csdn.net'后,使用http://www.csdn.net访问,不弹出设为主页提示窗口了,但是如果用http://csdn.net这个网址访问,还是弹出提示窗口啊,怎么办呢?
      

  6.   

    如果URL参数是在另一个域中的话,isHomePage的返回值始终是False