自己做一个div,以iframe等作为载体

解决方案 »

  1.   

    上面那个div是用iframe为载体的啊,问题是怎么样才能接受用户响应
      

  2.   

    不要告诉我就是你blog上的那<<弹出一个div模拟的模态框,提示用户是否执行操作。大家试试就知道了,不用多说。>>完全是不一样的概念,我要的是confirm,只是界面自己定制而已
      

  3.   

    我的思路是简单的说一下:
    MessageBox类,
    有两个方法
    Show(aA,Caption,Icon,dH)//aA是提示内容,Caption是标题,Icon是图标,dH是按钮
    Close()//关闭
    <a href="http://www.csdn.com" onclick="return MessageBox.Show('确定要删除吗','系统提示',ICON_QUESTION,MB_YESNO)"></a>
    <a href="http://www.csdn.com" onclick="return confirm('确定要删除吗')"></a>我想要的是这两个效果相同,点击超级链接的时候跳出对话框,点确定前往链接地址
      

  4.   

    不要告诉我就是你blog上的那<<弹出一个div模拟的模态框,提示用户是否执行操作。大家试试就知道了,不用多说。>>完全是不一样的概念,我要的是confirm,只是界面自己定制而已
    ----------------------------------------------------
    我blog里留言的人 luhang 是你么?你可能是JS刚入门吧,我的确不想伤你,也不想说你了...
    看我在我blog里的回复....汗....你到底懂不懂handler在这里面是什么?  那你看看这样?上面的handler改成function handler(){window.location.href="http://www.csdn.net";}<a href="javascript:neverDialog(event,'Are You Sure To Excute it?','handler()')">csdn</a> 
      

  5.   

    楼主的意思是实现一个模式对话框,来代替js中的confirm方法。在js中,其实无法实现一个div作为模式对话框来显示,也就是说,代码无法暂停等待你的用户交互。作为一种可选方案,你可以使用showModalDialog()来模拟你的要求。惟一的遗憾可能是你无法完全自定义自己的界面,但showModalDialog()依然给你很大的自由空间。showModalDialog(sURL[,vArguments[,sFeatures]])sURL:对话框窗口中显示的页面URL
    vArguments:传入参数.可以是数组
    sFeatures:窗口样式其中,用showModalDialog产生了窗口后,焦点无法移回主窗口.
    用产生了窗口后,焦点可以移回主窗口,可是弹出的对话框却一直保持在主窗口之上.在showModalDialog的页面中,使用returnValue来返回任何值。
      

  6.   

    BlueDestiny你都没看懂我的意思,非要拿自己的东西出来说服别人,我就是想象tttk(网络芝麻)说的那样,自己实现模式对话框来代替js中的confirm方法,只是无法实现暂停等待与用户交互
      

  7.   

    模态,没法实现,showModalDialog只有IE有.
    碰到这种情况,只能通过callBack来完成.
      

  8.   

    ykluhang(勿伤我心) js模拟confirm对话框,对话框用DIV来表示,显示对话框的时候用一个div把所有内容盖住不能进行别的操作,然后在这这个DIV上面用一个DIV来表示对话框,对话框上内容和按钮都可以定制,关闭的时候把这两层隐藏,现在的问题是,当点击超链接<a href="http://www.csdn.com" onclick="return MessageBox.Show()"></a>显示对话框的时候,怎样才能让页面不跳转,等用户点确定的时候才跳转到链接页
    -----------------------------------我也不想说太多了,你上面说的功能我都已经基本实现了。如果你非要争,我也不想说什么,你一定要别人帮你实现你心里想的东西,我想谁都不会有那个时间。
    也许是我理解错,我也不想争了,你都还不明白modalDialog的意思。我没有硬要拿我做的东西硬加在你的这个标题上,而且我也没有拿我的东西加在你的标题上,你直接就是一根本就不管用。我还在这里跟贴是要说明,我没有理由来帮你,但是你却觉得我欠你什么似的,在我的blog里还要说根本就不管用,请问我就是一定帮你写的这个code,我写的代码有没有用自在人心。
      

  9.   

    <?xml version="1.0" encoding="UTF-8"?> 
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
     <title> - http://www.never-online.net </title>
     <meta http-equiv="ImageToolbar" content="no" />
     <meta name="author" content="BlueDestiny, never-online"/>
     <meta name="keywords" content="never modules, Mozilla CSS, C#, .net, Refercence, BlueDestiny, never-online, www.never-online.net"/>
     <meta name="description" content="BlueDestiny, never-online"/>
     <meta name="title" content="Mozilla CSS Refercence And Demo - http://www.never-online.net" />
     <meta name="creator.name" content="Genius Lau, never-online, blueDestiny" />
     <style type="text/css" media="all" title="Default">
        body { background-color:appworkspace; }
        .button { font-size:9pt; font-family:verdana; border-left:4px solid #444; border-top:1px solid #444; border-bottom:1px solid #444; border-right:1px solid #444; }
     </style>
     <script type="text/javascript">
     //<![CDATA[
      function neverDialog(e, msg, handler) {
        // Script by BlueDestiny, never-online
        // Simple simulate modal dialog
        // welcome to http://blog.never-online.net
        // http://blog.csdn.net/BlueDestiny/
        // and keep these copyright
        window._x = null;
        if (e) e.srcElement ? e.srcElement.blur() : e.target.blur();
        if (_x) window.clearTimeout(_x);
        var $=document.getElementById;
        var d = $("dialog");
        var a = $("demo");
        var Htmls = "";
        var cnt = 20;
        Htmls += "<html>\n"
                + "<head>\n"
                + "<style text=\"text/css\">\n"
                + "body { margin:40px; background-color:#eeeeee; }\n"
                + "* { font-size:9pt; font-family:verdana; }\n"
                + ".bold { font-weight:bold; }\n"
                + ".button { width:100px; border-left:4px solid #444; border-top:1px solid #444; border-bottom:1px solid #444; border-right:1px solid #444; }\n"
                + "</style>\n"
                + "</head>\n"
                + "<body>\n"
                + "<p align='center'>never dialog demo, just a test, http://blog.never-online.net</p>\n"
                + "<p align='center' class='bold'>" +msg+ "</p>\n"
                + "<p align='center'>\n"
                + "<input class='button' type='button' value=' - O K - ' onclick='top.window.document.getElementById(\"demo\").style.display=\"none\";top.window.document.body.style.overflow=\"\"" +(handler?";top.window."+handler+"":"")+ "\'/>\n"
                + "<input type='button' class='button' value=' - N O -' onclick='top.window.document.getElementById(\"demo\").style.display=\"none\";top.window.document.body.style.overflow=\"\"'/>"
                + "</p>\n"
                + "</body>\n"
                + "</html>"
        d.contentWindow.document.open("text/html");
        d.contentWindow.document.write(Htmls);
        d.contentWindow.document.close();
          with(a.style) {
            display = "block";
            left="0px";
            top="0px";
            width=document.body.clientWidth;
            height=document.body.clientHeight;
          }
        function f_alpha() {
          if (cnt>=80) {
            window.clearTimeout(_x);
            return;
          }
          // if ie
          a.style.filter="alpha(opacity=" +(cnt++)+")";
          // mozilla
          _x = window.setTimeout(f_alpha, 1);
        }
        f_alpha();
        document.body.style.overflow = "hidden";
      }
      function handler() {
        window.location.href="http://blog.never-online.net/"
      }
     //]]>
     </script>
    </head>
    <body id="www.never-online.net" margin="0">
    <input type="button" value="Excute it" onclick="neverDialog(event,'Are You Sure To Excute it?','handler()')" class="button"/>
    <div height="100%" width="100%" style="display:none;position:absolute;-moz-opacity:0.6" id="demo">
    <iframe id="dialog" height="100%" width="100%" frameborder="0" marginheight="0" marginwidth="0" style="font-size:9pt; font-family:verdana;">
    </iframe>
    </div>
    </body>
    </html>