Javascript 单击以删除表

Javascript 单击以删除表,javascript,html,css,Javascript,Html,Css,好的,我试着制作一个全屏表格,点击这个表格就会消失并显示出身体本身。我在互联网上找到了以下代码,并对其进行了一些修改: <!DOCTYPE html> <html> <head> <script type="text/javascript"> /****************************************** * Popup Box

好的,我试着制作一个全屏表格,点击这个表格就会消失并显示出身体本身。我在互联网上找到了以下代码,并对其进行了一些修改:

    <!DOCTYPE html>
    <html>
        <head>
        <script type="text/javascript">

            /******************************************
            * Popup Box- By Jim Silver @ jimsilver47@yahoo.com
            * Visit http://www.dynamicdrive.com/ for full source code
            * This notice must stay intact for use
            ******************************************/

            var ns4=document.layers
            var ie4=document.all
            var ns6=document.getElementById&&!document.all

            function hidebox(){
            crossobj=ns6? document.getElementById("showimage") :
            document.all.showimage
            if (ie4||ns6)
            crossobj.style.visibility="hidden"
            else if (ns4)
            document.showimage.visibility="hide"
            }

        </script>
        </head>
        <body>
        <p>You can see this after a click</p>
        <div id="showimage" style="position:absolute;top:0;left:0;right:0;bottom:0">
            <table border="0" width="100%" height="100%" bgcolor="#000080" onClick="hidebox();return false">        
            </table>
        </div>
        </body>
    </html>
在不同的地方将bgcolor更改为background=“URL here”,结果就是不起作用。
请帮帮我,我真的很想让这一切顺利

在css中选择类似的元素:

table {
background: url("path/file.jpg");
background-repeat:no-repeat;
}
一切都有点像

.background {

}
这意味着html中存在这样一个类

<table class="background">

您的表没有类“背景”,CSS不正确。您还缺少背景规则中的右括号。对于HTML,它应该更像:

table {
    background: url("url here") no-repeat;
}

松开.background,只使用表{}。@user1721135将其作为答案发布。我认为如果我在
if(ie4 | | ns6){}之后添加class=“background”{}或者如果(ns4){}
哇,你的生活糟透了,如果复制你在某处发现的东西,那么学习你在生产中投入的东西又有什么用呢?你也把你在街上找到的所有东西都放进嘴里了吗?我也这样试过,但对我不起作用。如果您将我的代码复制到一个.html文件中,请更改您建议更改的内容并打开它-它对您有用吗?我的浏览器可能有问题吗?对我有用请看演示:非常感谢,它现在可以工作了:)我仍然有点困惑,它以前是怎么不工作的,但我会弄清楚的!Thankstory这只是这个网页上的一个输入错误,我在代码中正确地写了它,但它仍然不起作用。我将你的代码复制到一个HTML文件中,并使用了我上面提供的CSS,它对我有效。使用Chrome。谢谢你,现在可以用了,谢谢你的帮助:)
    /******************************************
    * Popup Box- By Jim Silver @ jimsilver47@yahoo.com
    * Visit http://www.dynamicdrive.com/ for full source code
    * This notice must stay intact for use
    ******************************************/

    var ns4=document.layers;
    var ie4=document.all;
    var ns6=document.getElementById&&!document.all;

    function hidebox(){
    crossobj=ns6? document.getElementById("showimage") :
    document.all.showimage;
    if (ie4||ns6)
    crossobj.style.visibility="hidden";
    else if (ns4)
    document.showimage.visibility="hide";
    }
table {
    background: url("url here") no-repeat;
}