<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>无标题页</title>
    <script type="text/javascript">
            function SendICBCPay()
            {   
                var btnSendICBC =document.getElementById("frmICBCPay").document.getElementById("btnSend");//.all["btnSend"];
                alert(btnSendICBC);
                //.click();
            }
        </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <input id="Button1" type="button" value="支付" onclick="SendICBCPay()" />
        <iframe name="frmICBCPay" border="0" src="WebPay/Default.aspx" />        
    </div>
    </form>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>无标题页</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
     <input id="btnSend" type="submit" value=" 提 交 订 单 "><br />
    </div>
    </form>
</body>
</html>以上是取Iframe中的btnSend然后要执行他的点击事件
但我取不到那个btnSend
大家看哪里出错了谢谢

解决方案 »

  1.   

    用框架的话,执行之后不会生成子页面的html代码,当然取不到页面里面的控件了
      

  2.   

    <iframe name="frmICBCPay" id="frmICBCPay" border="0" src="WebPay/Default.aspx" />  
      

  3.   

    var btnSendICBC = window.frames["frmICBCPay"].document.getElementById("btnSend");//.all["btnSend"];
    alert(btnSendICBC);
      

  4.   

    <iframe name="frmICBCPay" id="frmICBCPay" border="0" src="WebPay/Default.aspx" /> 
    window.frames["frmICBCPay"].document.getElementById("btnSend");
      

  5.   

    var btnSendICBC =document.getElementById("frmICBCPay").document.getElementById("btnSend");没见过这样的写法~每个框架是分离的`我觉得这样写不行~~还有就是getElementById取ID值而不是name值吧~~
      

  6.   

    var btnSendICBC =document.getElementById("frmICBCPay");
    btnSendICBC =btnSendICBC.getElementById("btnSend");
    试试看
    btnSend 只是一个提交按钮,你取他的值何用?或者可以用asp.net服务器控件实现
      

  7.   

     var btnSendICBC =frmICBCPay.document.getElementById("btnSend");
    //document.getElementById("frmICBCPay").document.getElementById("btnSend");//.all["btnSend"];
                    alert(btnSendICBC.id);
      

  8.   

    getElementById("frmICBCPay").或者改成getElementByName("frmICBCPay").
      

  9.   

    ID跟Name在IE中,如果没有设置ID,则跟name是一样的,没有问题,当然如果是firefox就有问题了