最好能写个小例子。

解决方案 »

  1.   

    var t = window.confirm("");
    if(t == true)
    {
    }?????
      

  2.   

    IntPtr ParenthWnd = FindWindow(null, "来自网页的消息");
                IntPtr EdithWnd = new IntPtr(0);
                if (ParenthWnd != IntPtr.Zero)
                {}
    http://topic.csdn.net/u/20100414/16/5017cf12-a2f8-4c97-b621-68e19a6cad88.html
      

  3.   

    楼主的意思表述清楚,获得?
    findwindow?
      

  4.   


    <div onclick="return confirm('确定要删除吗?')">
    <asp:LinkButton ID="lbDelete" runat="server" CommandName="del" CommandArgument='<%# Eval("UserId") %>'>删除</asp:LinkButton>
    </div>是这个意思吗
      

  5.   

    "<script>if(return confirm('是否继续')){//操作}</script>"
      

  6.   

      <div id="de" onclick="JavaScript:return confirm('确定删除吗?')">
                                            <asp:Button ID="btnDel" runat="server" Text="删除" CommandName="Del" />
                                        </div>是这个意思吗
      

  7.   


    我可能说的不清楚,网页弹出一个确认框,需要捕捉到它并且自动点击“确定”或“取消”。
    一步一步来,我想先学会怎样捕捉到这个confirm()弹出框。
      

  8.   

    3楼是正确的,使用FindWindow就可以捕捉到了。
      

  9.   


    请问"来自网页的消息"的是不是confirm()当中的字符串?
    比如onclick="confirm('关掉我')"之中的“关掉我”?
      

  10.   


    感谢提供代码,网页原形可以用3楼给的例子:
    <html>
    <head>
    <title>test</title>
    </head><body>
    <form method="POST" action="">
    <p><input type="button" value="按钮" name="B1" onclick="confirm('关掉我')"></p>
    </form>
    </body></html>
      

  11.   


    IntPtr ParenthWnd = FindWindow(null, "来自网页的消息");//找到弹出框的句柄
      IntPtr EdithWnd = new IntPtr(0);                   //new一个新的句柄
      if (ParenthWnd != IntPtr.Zero)                     //这一句是什么意思啊?
      {}
      

  12.   

    IntPtr ParenthWnd = FindWindow(null, "来自网页的消息");//找到弹出框的句柄
    //"来自网页的消息"为弹出窗体的标题
      IntPtr EdithWnd = new IntPtr(0); //new一个新的句柄
    //这一句可以不要//他这样写可能是想把下句写成if (ParenthWnd != EdithWnd ),一样效果
      if (ParenthWnd != IntPtr.Zero) //这一句是什么意思啊?
    //判断是否找到弹出框,若没有,句柄为0,非0为找到弹出框
      {}
      

  13.   

    哦,原来是这样,if (ParenthWnd != IntPtr.Zero) 就代表“如果(找到了弹出框)”,明白了谢谢!
    那么接下来,想要提取出该弹出框的文字要用到什么函数?比如12楼的例子当中,把“关掉我”这个文本提取出来该怎么做?
      

  14.   

    就用上面这个例子:
    <html>
    <head>
    <title>test</title>
    </head><body>
    <form method="POST" action="">
    <p><input type="button" value="按钮" name="B1" onclick="confirm('关掉我')"></p>
    </form>
    </body></html>那么在这个网页弹出对话框后,如果文本内容是“关掉我”,则模拟点击“确定”;
    反之,如果文本内容不是“关掉我”,就模拟点击“取消”。
    该怎么做啊各位大哥,帮帮我好吗