我有一个输入,我希望用户将输入的值发送到URI中,以便将其提取到另一个页面。
这是我的输入的设置方式:
<input name="date" id="datepicker" onchange="window.location.href = 'test.php?Date=' + document.getElementById("datepicker").value;">
基本上,当日期更改时,应将日期添加到URI的末尾,并将用户发送到test.php,在其中提取值。但是,似乎未添加该值。
有什么问题?
尝试:
<input name="date" id="datepicker" onchange="window.location.href = 'test.php?Date=' + this.value;">
您不需要执行此操作,document.getElementById('datepicker')
因为您所在的元素已经是您要从中获取值的元素。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句