HTML表单提交无法调用Javascript

时间:2017-07-14 16:44:35

标签: javascript html

对于我的生活,我无法弄清楚这一点。我有一个简单的HTML表单,我想称之为Javascript函数。任何人都可以帮我弄清楚为什么这不起作用?

这是一个演示: https://jsfiddle.net/m78z4xty/

的Javascript

function bbuniformSearch() {
newURL = document.getElementById('qta_field');
this.href='https://www.bestbuyuniforms.com/index.php?fc=module&module=leoproductsearch&controller=productsearch&orderby=position&orderway=desc&cate=&search_query='+newURL;}

HTML

<form method="POST" name="bbuSearch" onSubmit="bbuniformSearch()">
  <input type="text" id="qta_field" placeholder="Search for items"/>
  <input name="Submit"  type="submit" value="Search Now" onClick="bbuniformSearch()">
  </form>

0 个答案:

没有答案