window.parent.doSubmit();//假设doSubmit()是提交方法

解决方案 »

  1.   

    获取alt+s事件后直接调父窗口function
      

  2.   

    你在alt+s这个按键的事件里直接调用父窗口的事件
      

  3.   

    给iframe注册事件注意一点的是在ff时不能使用frame.document.onclick,这样不响应事件,需要addEventListener来添加事件
    eg
    <table width="300px" border="0" cellspacing="0" cellpadding="0">
    <tr><td style="border:1px solid #81a9ce;background:#fff;">
    <iframe id="editor" src="about:blank" style="height:100px;width:100%;background:#fff;" frameBorder="0" marginHeight='0' marginWidth='0' onload="setEditable()"></iframe>
    </td></tr></table>
    <script>
    var IsIE=!!document.all;
    function $(objId,IsFrame){
      if(IsFrame) return IsIE?frames[objId]:document.getElementById(objId).contentWindow;
      else return document.getElementById(objId);
    }
    function setEditable(){
      try{ 
        var frm=$('editor',true);
        doc=frm.document;       
        if(doc.body){
           doc.body.style.backgroundColor='#ffffff';
           doc.body.style.fontSize='12px';
           doc.body.style.fontFamily='verdana';
           doc.body.style.margin='4px';
        }
        doc.designMode="On";
        doc.contentEditable="True";
        InitFrameEvent(frm,doc);//注册事件
      }catch(e){alert(e)}
    }function InitFrameEvent(frm,doc){
      //=====================IE===================   
       if(IsIE)
         doc.onkeydown=function(){
           e=frm.event;//注意这里获取的是iframe中的事件对象      
           if(e.altKey&&e.keyCode==83)PostMethod()
         }
       else//firefox
         doc.addEventListener(
            'keydown'
            ,function(e){
              if(e.altKey&&e.keyCode==83){
                e.preventDefault();//你的快捷键和firefox的历史快捷键冲突,所以要阻止默认事件
                PostMethod();
              }
            }
           ,false);
    }function PostMethod(){
      alert('按下Alt+S键,执行ajax提交');
    }
    </script>