dskld5423 2015-05-28 13:18
浏览 184
已采纳

按钮重定向

Basically I have a textbox and i want when people paste/write a website inside, and press the button, to be redirected to the site with an extra parameter ("/play/bonus")

<input name="website" id="website" type="text" />
<form method="POST" action=document.getElementById('website') & "/play/bonus">
    <input name="pn" value="bonus" type="hidden">
    <button id="bonus" class="btn btn-default navbar-element pull-center">
        <b>50</b> 
        Satoshis
    </button>
  • 写回答

2条回答 默认 最新

  • duanjiao5082 2015-05-28 13:22
    关注
    document.getElementById('website')
    

    Will give the object of that element. You need to use .value.

    document.getElementById('website').value
    

    To get the value of element.

    And there is no need to use the javascript, I think so. If you are using PHP then use header function of PHP to redirect.

    Your HTML:

    <form method="POST" action="demo.php">
    <input name="website" id="website" type="text" />
    <input name="pn" value="bonus" type="hidden">
    <input id="bonus" type="submit" class="btn btn-default navbar-element pull-center" Value="50 Satoshis">
    </form>
    

    And your demo.php file will be like this:

    <?php
      $redirect = $_POST['website'];
      header("location:".$redirect."/play/bonus");
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 拟通过pc下指令到安卓系统,如果追求响应速度,尽可能无延迟,是不是用安卓模拟器会优于实体的安卓手机?如果是,可以快多少毫秒?
  • ¥20 神经网络Sequential name=sequential, built=False
  • ¥16 Qphython 用xlrd读取excel报错
  • ¥15 单片机学习顺序问题!!
  • ¥15 ikuai客户端多拨vpn,重启总是有个别重拨不上
  • ¥20 关于#anlogic#sdram#的问题,如何解决?(关键词-performance)
  • ¥15 相敏解调 matlab
  • ¥15 求lingo代码和思路
  • ¥15 公交车和无人机协同运输
  • ¥15 stm32代码移植没反应