【发布时间】:2021-11-28 15:00:44
【问题描述】:
当用户点击提交时,它应该打开http://127.0.0.1:5000/default/+UserInput。但是 giveme() 函数返回“?keyword=UserInput”而不是“UserInput”。如何获得正确的网址?
<form id="myform" class="form-horizontal" action="http://127.0.0.1:5000/default/" +
giveme() method="get" >
<div id="searchkeyword">
<div class="form-group">
<label for="keyword" class="col-sm-3 control-label">Enter keyword</label>
<div class="col-sm-4">
<input type="text" name="keyword" id="keyword" class="form-control">
<br>
</div>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-3 col-sm-9">
<button type="submit" class="btn btn-primary">Submit »</button>
<span class="small-paddingleft">*Required</span>
</div>
</div>
</form>
<script>
function giveme(){
document.getElementById("keyword").value;
}
</script>
【问题讨论】:
标签: javascript python html flask url