<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>fir</title> </head> <body> <form id="form" method = "post" action = "http://www.kuaidi100.com/query?type=yuantong&postid=postttt&id=1&valicode=&temp=123"> <label>用户名:</label> <input type="text" value="100605028323" postttt = "" id="txt" /> <input type="submit" value="确定" name="submit" id="sub"/> </form> <script> var txt = document.getElementById("txt"); var btn = document.getElementById("sub"); var form = document.getElementById("form"); console.log(typeof form.action); btn.onclick= function () { var action = form.action; form.action = action.replace(/postttt/, txt.value); } </script> </body> </html>
李夜
李夜
相关分类