gpt4 book ai didi

javascript - 使用 OnClick 事件仅重置 1 个单选按钮组

转载 作者:行者123 更新时间:2023-12-03 09:26:09 25 4
gpt4 key购买 nike

我有一个包含多个 radio 组的表单。我希望用户能够重置一个特定的单选按钮组,而无需重置整个表单。我创建了一个按钮,其值为重置参与级别。这是该按钮的单击事件的函数:

<script>
function ParticipationReset(){
document.getElementById('SponsorshipParticipaton_0').removeAttribute('disabled');
document.getElementById('SponsorshipParticipaton_1').removeAttribute('disabled');
document.getElementById('SponsorshipParticipaton_2').removeAttribute('disabled');
document.getElementById('SponsorshipParticipaton_3').removeAttribute('disabled');
document.getElementById('SponsorshipParticipaton_4').removeAttribute('disabled');
document.getElementById('SponsorshipParticipaton_5').removeAttribute('disabled');
document.getElementById('SponsorshipParticipaton_6').removeAttribute('disabled');
document.getElementById('ExhibitorParticipaton_0').removeAttribute('disabled');
document.getElementById('ExhibitorParticipaton_1').removeAttribute('disabled');
document.getElementById('SponsorshipParticipaton_0').checked = false;
document.getElementById('SponsorshipParticipaton_1').checked = false;
document.getElementById('SponsorshipParticipaton_2').checked = false;
document.getElementById('SponsorshipParticipaton_3').checked = false;
document.getElementById('SponsorshipParticipaton_4').checked = false;
document.getElementById('SponsorshipParticipaton_5').checked = false;
document.getElementById('SponsorshipParticipaton_6').checked = false;
document.getElementById('ExhibitorParticipaton_0').checked = false;
document.getElementById('ExhibitorParticipaton_1').checked = false;
}
</script>

但是,当我单击该按钮时,表单中的所有单选按钮都会重置,即使它们未在函数中指定。该页面的链接为 www.pfacmeeting.org/2016/exhibitorform.htm。

如有任何建议,我们将不胜感激。谢谢

cdr6545

最佳答案

发生这种情况是因为按钮设置为“重置”,对于特定重置,请将行更改为:

<input type="button" name="ResetSponsor" id="ResetSponsor" value="Reset Sponsorship Participation" onclick="javascript:SponsorshipReset(this);" />

类型=“按钮”

关于javascript - 使用 OnClick 事件仅重置 1 个单选按钮组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31659934/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com