<a href="">公司</a>我想点击"公司"这个链接,然后就有一个弹出框,上面有问题,回答正确才能链接到相应的页面这个用JS如何实现?

解决方案 »

  1.   

    就是一个弹出层,正如楼上所说,用Jquery很好实现的,自己写,也就几行!给你个思路!<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title></title>
        <style type="text/css">
            ul{list-style-type:none;}
            #cover{height:100%;width:100%;background:gray;position:absolute;top:0px;left:0px;display:none;filter:alpha(opacity=50);opacity:0.5;}
            #content{width:600px; height:100px; position:absolute;left:25%;top:25%;border:5px solid gray;display:none;background:white;}
            #content ul{height:20px;margin-top:0px;padding-right:5px;}
            #content ul li{float:right;cursor:pointer;width:50px;}
        </style>
        <script type="text/javascript">
            function showCover() {
                document.getElementById("cover").style.display ="block";
                document.getElementById("content").style.display="block";
            }
            function hideCover() {
                document.getElementById("cover").style.display = "none";
                document.getElementById("content").style.display = "none";
                alert("您选择了关闭");
            }
        </script>
    </head>
    <body>
        <input type="button" value="遮罩层" onclick="showCover();" />
        <div id="cover" />
        <div id="content">
            <ul>
                <li onclick="hideCover()">[关闭]</li>
                <li onclick="hideCover()">[确定]</li>
            </ul>
        </div>
    </body>
    </html>