document.frames("editor").document.all.inputName.value

解决方案 »

  1.   

    是这样的,iframe只有这一句:document.write('<iframe ID="editor" NAME="editor" style="width: 500; height:400;display:none"></iframe>');上边没有其他的input,用document.frames("editor").document.all.inputName.value得不到值不过突然发现
    // 编辑器初始化
      function win_init(){
                  document.all.editor.src = "edit.htm";
                  window.status = "程序载入中,请等待……";
          }调用了edit.htmedit.htm 有调用了 editor.htm<iframe ID="edit1" SRC="editor.htm" NAME="myEditor" onfocus="document.all.editbar._editor = window.frames[this.id];" style="width: 100%; height: 90%;"></iframe>这个是editor页的代码
    <HTML>
    <HEAD>
    <TITLE>richTextEditor</TITLE>
    </HEAD><STYLE>
    BODY {margin: 0pt; padding: 0pt; border: none}
    IFRAME {width: 100%; height: 100%; border: none}
    </STYLE><SCRIPT src=editor.js language=JScript></SCRIPT><BODY SCROLL=no>
    <IFRAME ID=textEdit></IFRAME>
    </BODY>
    </HTML>
      

  2.   

    这个是 edit页面的代码<html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>ABC代码 编辑器</title>
    <link rel="STYLESHEET" type="text/css" href="htmlediter.css">
    <script src="chinacecc.js" language="JScript"></script>
    <script language="JavaScript">
    //===========================================
    //打开图片列表窗口,并设置接收返回值的目标 
    //===========================================
    function openImageList(href) {
        var newwin=window.open(href,"","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=520,height=400");
        newwin.focus();
        return;
    }
    //打开附件列表窗
    function openFileList(href) {
    var newwin=window.open(href,"","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=520,height=400");
    newwin.focus();
    return;
    }
    //============================================
    //接收返回的图片代码,并插入图片
    //============================================
    function receiveVal(val) {
    UploadComplete(val);
    }
    //接收返回的文件链接代码,并插入
    function receiveFileVal(val) {
    myEditor.pasteHTML(val);
    }
    //--></script>
    </head>
    <body SCROLL="no" STYLE="border: 0pt" bgcolor="white">
    <fieldset>
    <table border="0" cellspacing="0" cellpadding="0" width="490">
      <tr>
        <td id="fore" class="coolButton" onclick="showfore()" title="更多工具栏" style="display: none; padding: 0" align="right" width="1"></td>
        <td align="left" width="488"> 
          <table id="editbar" class="coolBar" cellspacing="0" cellpadding="0" style="font-weight: bold; border: 0 solid buttonface;z-index=2;" width="486">
            <tr>
          <td style="width:3px;cursor:move;" width="11"></td>
              <td class="coolButton" onclick="doFormat('Bold')" title="粗体" width="19"><img src="images/bold.gif" WIDTH="16" HEIGHT="16"></td>
              <td class="coolButton" onclick="doFormat('Italic')" title="斜体" width="19"><img src="images/italic.gif" WIDTH="16" HEIGHT="16"></td>
              <td class="coolButton" onclick="doFormat('Underline')" title="下划线" width="19"><img src="images/underline.gif" WIDTH="16" HEIGHT="16"></td>
        
          <td style="width: 4;" width="12"><img src="images/separator.gif" WIDTH="2" HEIGHT="18"></td>
          <td class="coolButton" onclick="doFormat('Undo')" title="撤销" width="19"><img src="images/undo.gif" width="16" height="16"></td>
          <td class="coolButton" onclick="doFormat('Redo')" title="恢复" width="19"><img src="images/redo.gif" width="16" height="16"></td>

          <td style="width: 4;" width="12"><img src="images/separator.gif" WIDTH="2" HEIGHT="18"></td>
          <td class="coolButton" onclick="doFormat('JustifyLeft')" title="左对齐" width="19"><img src="images/jleft.gif" WIDTH="16" HEIGHT="16"></td>
              <td class="coolButton" onclick="doFormat('JustifyCenter')" title="居中" width="19"><img src="images/jcenter.gif" WIDTH="16" HEIGHT="16"></td>
              <td class="coolButton" onclick="doFormat('JustifyRight')" title="右对齐" width="19"><img src="images/jright.gif" WIDTH="16" HEIGHT="16"></td>

          <td style="width: 4;" width="12"><img src="images/separator.gif" WIDTH="2" HEIGHT="18"></td>
              <td class="coolButton" onclick="doFormat('Cut')" title="剪切" width="19"><img src="images/cut.gif" WIDTH="16" HEIGHT="16"></td>
              <td class="coolButton" onclick="doFormat('Copy')" title="复制" width="19"><img src="images/copy.gif" WIDTH="16" HEIGHT="16"></td>
              <td class="coolButton" onclick="doFormat('Paste')" title="粘贴" width="19"><img src="images/paste.gif" WIDTH="16" HEIGHT="16"></td>
              <td class="coolButton" onclick="doFormat('Delete')" title="删除" width="19"><img src="images/delete.gif" WIDTH="16" HEIGHT="16"></td>          <td style="width: 4;" width="12"><img src="images/separator.gif" WIDTH="2" HEIGHT="18"></td>
              <td class="coolButton" onclick="doFormat('CreateLink')" title="插入链结" width="19"><img src="images/link.gif" WIDTH="16" HEIGHT="16"></td>
      <td class="coolButton" onclick="openFileList('../../normal/file/filelist.jsp')" title="添加附件"><img src="images/upfiles.gif" WIDTH="16" HEIGHT="16"></td>
              <td class="coolButton" onclick="AddImg()" title="插入图片" width="19"><img src="images/image.gif" WIDTH="16" HEIGHT="16"></td>    
        <form name=upload target=uploadback method="post">
         <input type="hidden" name="CopyrightInfo" value="http://www.chinacecc.com" ID=Hidden1>
                <td class="coolButton" id=UploadImg style="display: none;width:100;" nowrap width="46">
                  <input type=button value="选择" onclick="openImageList('../../normal/meta/imagelist.jsp');">
    <input type=reset name=reset1 value="取消" style="width:5:height:18" onclick="CancelAddImg()">
    </td>
    </form>
      

  3.   

          <td style="width: 4;" width="12"><img src="images/separator.gif" WIDTH="2" HEIGHT="18"></td>
              <td class="coolButton" onclick="doFormat('BackColor',bkcolorimg.style.backgroundColor)" title="突出显示颜色" width="19">
                <img src="images/colorpen.gif" width="16" height="16" style="background-color:#FFFFFF" id=bkcolorimg></td>
          <td class="coolButton" onclick="palette(bkcolorimg)" title="选择突出显示颜色" style="font: 5pt;width:3pt;" width="15">▼</td>
              <td class="coolButton" onclick="doFormat('ForeColor',colorimg.style.backgroundColor)" title="字体颜色" width="19"><img src="images/fontcolor.gif" width="16" height="16" style="background-color:#000000" id=colorimg></td>
              <td class="coolButton" onclick="palette(colorimg)" title="选择字体颜色" style="font: 5pt;width:3pt;" width="15">▼</td>       <td style="width: 4;" width="10"><img src="images/separator.gif" WIDTH="2" HEIGHT="18"></td>
              <td class="coolButton" onclick="return false;showHelp()" title="帮助" width="23" align="center"><img src="images/help.gif" width="16" height="16"></td>
    </tr>
    </table>
    <iframe height=0 width=0 style="visibility: hidden" id=uploadback name=uploadback></iframe>
          <table id="editbar1" class="coolBar" cellspacing="0" cellpadding="0" style="font-weight: bold; border: 0 solid buttonface;z-index=3;display:block;" width="487">
            <tr> 
              <td style="width: 3;" width="4"> </td>
              <td class="coolButton" onclick="doFormat('Outdent')" title="减小缩进" width="17"><img src="images/outdent.gif" WIDTH="16" HEIGHT="16"></td>
              <td class="coolButton" onclick="doFormat('Indent')" title="增加缩进" width="17"><img src="images/indent.gif" WIDTH="16" HEIGHT="16"></td>
              <td class="coolButton" onclick="doFormat('InsertHorizontalRule')" title="插入水平线" width="17"><img src="images/hr.gif" WIDTH="16" HEIGHT="16"></td>
              <td style="width: 4;" width="5"><img src="images/separator.gif" WIDTH="2" HEIGHT="18"></td>
              <td class="coolButton" onclick="doFormat('FormatBlock','&lt;OL&gt;')" title="编号" width="17"><img src="images/ol.gif" WIDTH="16" HEIGHT="16"></td>
              <td class="coolButton" onclick="doFormat('FormatBlock','&lt;UL&gt;')" title="项目符号" width="17"><img src="images/ul.gif" WIDTH="16" HEIGHT="16"></td>
              <td style="width: 4;" width="5"><img src="images/separator.gif" WIDTH="2" HEIGHT="18"></td>
              <td class="coolButton" onclick="addTable()" title="插入表格" width="17"><img src="images/table.gif" WIDTH="16" HEIGHT="16"></td>
              <td style="width: 4;" width="5"><img src="images/separator.gif" WIDTH="2" HEIGHT="18"></td>
              <td class="coolButton" onclick="doFormat('RemoveFormat')" title="去除格式" width="17"><img src="images/unformat.gif" WIDTH="16" HEIGHT="16"></td>
              <td style="width: 4;" width="5"><img src="images/separator.gif" WIDTH="2" HEIGHT="18"></td>
              <td id="formatSelect" style="padding: 0;" title="段落格式" width="88"> 
                <select onchange="doSelectClick('FormatBlock',this);this.returnValue=false;" style="font: icon; width: 80px;" id="select1" name="select1">
                  <option>段落格式</option>
                  <option VALUE="&lt;P&gt;">普通 
                  <option VALUE="&lt;PRE&gt;">已编排格式 
                  <option VALUE="&lt;H1&gt;">标题一 
                  <option VALUE="&lt;H2&gt;">标题二 
                  <option VALUE="&lt;H3&gt;">标题三 
                  <option VALUE="&lt;H4&gt;">标题四 
                  <option VALUE="&lt;H5&gt;">标题五 
                  <option VALUE="&lt;H6&gt;">标题六 
                  <option VALUE="&lt;H7&gt;">标题七 
                </select>
              </td>
              <td id="fontSelect" style="padding: 0;" title="字体" width="58"> 
                <select onchange="doSelectClick('FontName',this);" style="font: icon; width: 50px;">
                  <option>字体</option>
                  <option VALUE="宋体">宋体 
                  <option VALUE="楷体_GB2312">楷体 
                  <option VALUE="隶书">隶书 
                  <option VALUE="黑体">黑体 
                  <option VALUE="仿宋_GB2312">仿宋 
                </select>
              </td>
              <td id="sizeSelect" style="padding: 0;" title="字体大小" width="83"> 
                <select onchange="doSelectClick('FontSize',this);" style="font: icon; width: 75px;">
                  <option>字体大小</option>
                  <option VALUE="1">1 
                  <option VALUE="2">2 
                  <option VALUE="3">3 
                  <option VALUE="4">4 
                  <option VALUE="5">5 
                  <option VALUE="6">6 
                  <option VALUE="7">7 
                </select>
              </td>
              <td style="padding: 0;" title="特殊字体格式" width="108"> 
                <select id="specialtype" onchange="doSelectClick('FormatBlock',this);this.returnValue=false;" style="font: icon; width: 100px;">
                  <option>特殊字体格式</option>
                  <option VALUE="SUP">上标 
                  <option VALUE="SUB">下标 
                  <option VALUE="DEL">删除线 
                  <option VALUE="BLINK">闪烁 
                  <option VALUE="BIG">增大字体 
                  <option VALUE="SMALL">减小字体 
                </select>
              </td>
              <td style="width: 4;" width="10"><img src="images/separator.gif" WIDTH="2" HEIGHT="18"></td>
            </tr>
          </table>
    </td>
        <td align="right" width="10">&nbsp; </td>
        <td align="right" class="coolButton" onclick="showmore()" title="更多工具栏" style="padding: 0" id="more" width="1"></td>
      </tr></table>
    </fieldset>
    <iframe ID="edit1" SRC="editor.htm" NAME="myEditor" onfocus="document.all.editbar._editor = window.frames[this.id];" style="width: 100%; height: 90%;"></iframe>
     <input type="hidden" name="content">
      <input type="hidden" name=body ID=Hidden1>
    <iframe id="uploadback" name="uploadback" style="display:none"></iframe>
    <script language="javascript">
    if((window.navigator.userAgent.indexOf("IE 5") < 1) && (window.navigator.userAgent.indexOf("IE 6") < 1)) {
    alert("请使用Microsoft Internet Explorer 5.0\n或更高版本的浏览器!");
    window.close();
    }
    window.onload = init;
    window.onresize = fixSize;
    document.all.editbar._editor = window.frames[document.all.edit1.id];
    document.all.editbar1._editor = window.frames[document.all.edit1.id];
    </script>
    </body>
    </html>