最简单的就是把表单的 target 设置为 iframe 的 name ,作一个最传统的表单提交动作

解决方案 »

  1.   

    meizz(梅花雪) ( ) 信誉:709 
       最简单的就是把表单的 target 设置为 iframe 的 name ,作一个最传统的表单提交动作梅花雪大哥可否把問題說明白點,我的要求是靜態頁面來完成,提交表單好像不能在靜態頁面中取值吧!1
      

  2.   

    <html>
    <body>
    <table width="200" border="1">
      <tr>
        <td>
          <input type="text" name="itemno" id="itemno"/>
        </td>
        <td>
          <input type="button" name="Submit" value="Submit" onclick="window.frames['iframe'].location='iframe.htm?itemno='+document.getElementById('itemno').value"/>
        </td>
      </tr>
      <tr>
        <td>
           <a herf="鏈接的頁面">鏈接</a>
        </td>
        <td>
    <iframe id="iframe" name=" iframe " src=" iframe.htm"></iframe>
        </td>
      </tr>
    </table>
    </body>
    </html>
    ---iframe.htm-----------
    <script language="javascript">
    <!--
    function getParam( name )
    {
    str = location.search.substr(1);
    re  = new RegExp( "(^|&)"+name+"=([^&]+)", "i" );
    res = str.match(re);
    if( res ) return res[2];
    else return null;
    }
    alert(getParam( "itemno" ));
    //-->
    </script>取到值之后显示图片加链接就略了
      

  3.   

    看看这样是否达到了需求:
    index:
    <input type="button" name="Submit" value="Submit" onclick="window.iframename.setImg(document.getElementById('itemno'))"/>
    iframe:
    <head>
    <SCRIPT LANGUAGE="JavaScript">
    function setImg(img){
    document.getElementById('itemno').src=img;
    }
    </SCRIPT>
    </head>
    <body>
    <img src="" id="itemno">
    </body>
    至于让iframe显示link页面:
    <a herf="鏈接的頁面" target="iframename">鏈接</a>
    <iframe id="iframe" name="iframename " src=" iframe.html"></iframe>