日期:2014-05-16  浏览次数:20435 次

紧急呼救:求弹出式窗口代码
在web开发中,要求一弹出窗口效果:

弹出一个自制的窗口,而不是一个链接窗口,要求位于最上层,像51job里面点击工作地点的时候,就会给出一个对话框供你选择,效果一样.

麻烦各位高手帮忙啦!


------解决方案--------------------
那是用div层来做的吧。我常用的方法的是:
点击后 把一个层显示出来 这个层的z-index属性设置的大一点 ,再规定一下它的长宽和 position属性 就行了
------解决方案--------------------
51job那只是一个DIV层。不是窗体级的。就像楼上所说,设个DIV,用absolute定位,Z-index设一个大点的值就OK了。
------解决方案--------------------
//自制弹出对话框
1.主页面 

HTML code

<form name="form1" action="">
    <input type="text" name="username">
    <input type="button" name="submitForm" value="提交" onclick="submitForm1();">
</form>
<script>
    function submitForm1(){
        var result=window.showModalDialog("myconfirm.html",
            2,"dialogWidth:240px;dialogHeight:120px;status:no;");
        if(result==1){
            check(document.getElementsByName("form1")[0]);
        }
    }
    function check(frm){
        var username=document.getElementsByName("username")[0];
        var result;

        if(username.value==""){
            result=window.showModalDialog("myconfirm.html",
            new Array(1,"请输入用户名"),"dialogWidth:240px;dialogHeight:120px;status:no;");
            return;
        }
        frm.submit();
    }
</script>