dtny30176 2013-04-05 02:12
浏览 16
已采纳

将HTML值发布到IFrame

How would I use the post function to pass fields onto an IFrame? I am using the target label but it doesn't seem to work. What is supposed to happen is when I submit the fields, it posts the username and variable to a forum and logs me in. However, I am only being redirected to the login page instead. It might be helpful to know that the iframe is in a different file than the field.

     <form action="http://www.website.net/login.php" method="post" target="my_iframe">
        <label for="username">Username</label><input type="text" name="username" required>
        <label for="password">Password</label><input type="password" name="password" required>
        <input type="submit" name="login" value="Login" class="loginbtn"/><a href="http://www.website.net/register.php">Register</a>
      </form>

     <iframe name="my_iframe" src="http://www.website.net/forums/ucp.php?mode=login" frameborder="0" scrolling="auto" width="100%" height=1500px marginwidth="0" marginheight="5" ></iframe>
  • 写回答

1条回答 默认 最新

  • dqce48404 2013-04-05 03:18
    关注

    Try that:

    <form action="http://www.website.net/login.php" method="post" target="my_iframe">
            <label for="username">Username</label><input type="text" name="username" required>
            <label for="password">Password</label><input type="password" name="password" required>
            <input type="submit" name="login" value="Login" class="loginbtn"/><a href="http://www.website.net/register.php">Register</a>
          </form>
    
         <iframe name="my_iframe" src="http://www.website.net/forums/ucp.php?mode=login" frameborder="0" scrolling="auto" style="width:100%;height:1500px;margin: 5px 0;"></iframe>
    

    You forgot to insert "" in the height iframe's property.

    Remember to always use CSS then HTML proprerties, they are deprecated as per W3C HTML5/XHTML 1.0 rules.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥17 pro*C预编译“闪回查询”报错SCN不能识别
  • ¥15 微信会员卡接入微信支付商户号收款
  • ¥15 如何获取烟草零售终端数据
  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?
  • ¥15 matlab(相关搜索:紧聚焦)