当前页面test1.htm , 在test1上放置一个test.jpg图片
要实现的结果是:单击test.jpg就能关闭test1.htm
改怎样写程序????

解决方案 »

  1.   

    <img onclick='window.opener=null;window.close()'/>
      

  2.   


    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <html>
    <head>
    <title> New Document </title>
    <meta name="Generator" content="EditPlus">
    <meta name="Author" content="">
    <meta name="Keywords" content="">
    <meta name="Description" content="">
    <script type="text/javascript">
    function closeWind() {
    window.close();
    }
    </script>
    </head><body>
    <input type="button" value="close" onclick="closeWind()"/>//这里可以换成img标签
    </body>
    </html>
      

  3.   

     <img src="icon.gif" onclick="javascript:window.close();" />
    这样就可以了
      

  4.   

    在ie中: 直接调用window.close()时会有关闭提示,可以这样写:
    window.opener=null;window.open("","");window.close();这样可以在ie下无提示关闭浏览器.\
    如果在firefox中,就不能关闭了...提示不允许关闭非脚本打开的窗口.可以通过更改ff设置来改变.
    打开firefox,在地址栏输入about:config 
    找到dom.allow_scripts_to_close_windows这项并改为true。 
    如果LZ还有其它什么好的办法,找到后,共享一下...
      

  5.   

    window.close();    为每天10分而来
      

  6.   

    window.close() ie下没法关闭。有没有这种情况。
      

  7.   

    多谢楼主,多谢各位 window.close(),借用了