开发者

I need help with forms submit, please read for details

I would like to cre开发者_开发百科ate a form where the user can put a number in like "12345" and when the submit button is clicked have the result be http://www.URL.com/12345


Do you need that data to be posted somewhere, or do you just want to jump to that location? You could try without a form:

<label for="number">Number: </label>
<input type="text" id="number" /><br />
<input type="button" 
    onclick="window.location='http://www.URL.com/'+document.getElementById('number').value;" />


Here's the jQuery version separating the events from the markup. Demo can be seen here

<html>
<head>
    <script type="text/javascript" src="jquery-1.4.2.js"></script>
    <script>
      var url="http://www.url.com/";
      $(document).ready(function(){$("#go").click(function(){
           url+=$("#parameter").val()
           window.location=url;
           });
       });
    </script>
</head>
<body>
    <input type="text" id="parameter"/>
    <button id="go">Go</button>
</body>

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜