【发布时间】:2015-07-20 11:48:23
【问题描述】:
我有一个 Feedburner 订阅表单,其中有两个按钮,一个用于每日新闻,一个用于每周新闻。问题是如何在提交之前更改名称为 'uri' 的隐藏输入字段的值?我的解决方案不起作用。
这是我尝试使用的:
<form id="feedburner" action="https://feedburner.google.com/fb/a/mailverify"
method="post" target="popupwindow">
<p>
<input autocomplete="off" value="Enter your email…"
onblur="if (this.value == '') {this.value = 'Enter your email…';}"
onfocus="if (this.value == 'Enter your email…') {this.value = '';}"
type="text" name="email"/>
<input type="hidden" name="uri"/>
<input type="hidden" name="loc" value="en_US"/>
</p>
<input type="submit" value="Daily" onsubmit="document.getElementsByName('uri').value = 'androidinfodaily'; window.open('https://feedburner.google.com/fb/a/mailverify?uri=androidinfodaily', 'popupwindow'); return true" checked>
<input type="submit" value="Weekly" onsubmit="document.getElementsByName('uri').value = 'androidinfoweekly'; window.open('https://feedburner.google.com/fb/a/mailverify?uri=androidinfoweekly', 'popupwindow'); return true">
</form>
已解决
我已经修复了我的代码,现在它可以工作了。这是最终的变体:
<form id="feedburner" action="https://feedburner.google.com/fb/a/mailverify"
method="post" target="popupwindow">
<p>
<input autocomplete="off" value="Enter your email…"
onblur="if (this.value == '') {this.value = 'Enter your email…';}"
onfocus="if (this.value == 'Enter your email…') {this.value = '';}"
type="text" name="email"/>
<input type="hidden" name="uri" />
<input type="hidden" name="loc" value="en_US"/>
</p>
<input type="submit" value="Daily" onclick="document.getElementsByName('uri')[0].value = 'androidinfodaily'; window.open('https://feedburner.google.com/fb/a/mailverify?uri=androidinfodaily', 'popupwindow'); return true">
<input type="submit" value="Weekly" onclick="document.getElementsByName('uri')[0].value = 'androidinfoweekly'; window.open('https://feedburner.google.com/fb/a/mailverify?uri=androidinfoweekly', 'popupwindow'); return true">
</form>
【问题讨论】:
标签: javascript jquery html forms