解决方案 »

  1.   


    <!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=gb2312" />
    <title>无标题文档</title>
    </head><body style="">
    <div style="width:960px;height:65px;clear:both;margin-left:auto;margin-right:auto;background:url(http://www.lyfcw.com/template/blue/images/bodybg.jpg) no-repeat center top;" id="mytopbg">
    <div style="width:30px;height:12px;float:right;margin-bottom:0px;border:solid 1px white;margin-top:46px;font-size:10px;line-height:12px;text-align:center;color:white;cursor:pointer;" onclick="mytopbgfun()">关闭</div>
    </div>
    <script>
    var mytopbg=document.getElementById("mytopbg");
    function mytopbgfun(){
    mytopbg.style.background="none";
    }
    </script>
    <br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
    </body>
    </html>
      

  2.   

    楼上的,背景关闭了,但是大DIV里的小DIV没被关闭。而且哪个"关闭"两个字没有消除。背景是全屏铺开的。
      

  3.   

    <div style="width:30px;height:12px;float:right;margin-bottom:0px;border:solid 1px white;margin-top:46px;font-size:10px;line-height:12px;text-align:center;color:white;cursor:pointer;" onclick="mytopbgfun()">关闭</div>还需要关闭这个框本身
      

  4.   

    我要让他关闭外面最大的一个DIV背景没看明白楼主说的什么东东。。顶部的div不显示背景图片?加个背景色就行了
    mytopbg.style.backgroundColor = "#ffffff";
      

  5.   

    这是一个关闭网站背景的效果。但关闭的是BODY。我想让他关闭BODY内的第一个DIV,因为我做了个大DIV用做背景的。所以我要让点击关闭的时候,关闭第一个DIV的背景,以及关闭按钮所在的DIV。也就是关闭背景以及关闭后关闭的按钮消失。
    现在的状态是关闭背景,按钮也消失了。但背景在BODY层里,不是在第一个DIV层里
      

  6.   

     我发的代码测试下就知道。能正常使用,也是我要的效果,但背景在BODY里<body style="background:url(http://www.lyfcw.com/template/blue/images/bodybg.jpg) no-repeat center top;"> 我要背景在第一个DIV里,效果和我发的一致
      

  7.   

    假定现在有 
    背景 A
    DIV B
    DIV C
    原来点击 C 则 隐藏B  设置A的背景图片为空那么你现在 希望怎么样的结果?请按我说的方式 在描述下 
      

  8.   

    背景 A   (body层)
    DIV B    (背景层)
    DIV C     (关闭按钮所在层)现在是点击c关闭的是A+C
    我想要点击c关闭B+C
      

  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>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>无标题文档</title>
    </head><body>
    <div style="width:100%; overflow:hidden;clear:both;margin-left:auto;margin-right:auto;background:url(http://www.lyfcw.com/template/blue/images/bodybg.jpg) no-repeat center top;" id="mytopbg">
    <div style="width:30px;height:12px;float:right;margin-bottom:0px;border:solid 1px white;margin-top:46px;font-size:10px;line-height:12px;text-align:center;color:white;cursor:pointer;" onclick="mytopbgfun()">关闭</div>
    <script>
    var mytopbg=document.getElementById("mytopbg");
    function mytopbgfun(){
    mytopbg.style.display="none";
    document.body.style.background="none";
    }
    </script>
    <div style="height:1000px; width:960px; margin:80px auto">我想要的是点击关闭后这段文字还存在,因为这里是主框架,但背景不能写在body里</div>
    </div>
    </body>
    </html>