如何将表单操作更改为文本输入?

how can change form action to text input?

我想根据输入值更改我的表单目标。 我该怎么做?

<form id="form" method="POST" action="x.php" onSubmit="">
  <input type="url" id="address" value="google.com">
  <input type="submit" id="go" value="Go">
</form>

示例:当我将http://google.com设置为地址值时,将此表单发送到google.com。

<script src="//code.jquery.com/jquery-1.11.3.min.js"></script> 

 <script type="text/javascript">
            $(document).ready(function () {
                $("#address").blur(function () {
                    var form = document.getElementById('form');
                        form.action = $("#address").val();
                });
            });
</script>

<form id="form" method="POST" action="x.php" onSubmit="">
  <input type="text" id="address" value="google.com">
  <input type="submit" id="go" value="Go">
</form>

我用 “How do I get the value of text input field using JavaScript?” & "How can I set the form action through JavaScript?" 来写我的代码:

<script type="text/javascript">
    function get_action(form) {
        form.action = 'http://'+document.getElementById("address").value;
    }
</script>

<form onsubmit="get_action(this);">
  <input type="text" id="address" value="google.com">
  <input type="submit" id="go" value="Go">
</form>