重置下拉列表和javascript值

时间:2014-07-20 19:47:57

标签: javascript php html forms

要查看问题,请使用以下链接:example page

如果您选择广告类型并选择所需的问题数量,它会给您一个子总数,增值税和总数。这很好,但是如果用户决定他们想要选择不同的广告,则问题框会重置为默认消息,但子总计,增值税和总计不重置为零,它们保留了为此而花费的金额。以前的问题的新广告。只有在再次更改广告后,子总计ect文件才会更改为0。

我如何让他们马上改变?

这是用于获取广告类型值的javascrip语句。

if (document.getElementById('advert').value == "item 2 - half page" && document.getElementById('addissues').value == "1 issue")  {adcharge = 320;}

此变量'adcharge'随后显示为小计。

下拉代码:

<select name="advert" id="advert"  onchange="calculate('');"  class="validate[required]">
                          <option value="">Please select the advert required</option>

<option value="Back Cover Display Advert (Full Page)">Back Cover Display Advert (216mm x 154mm)</option>                          
<option value="Inside Front Cover Display Advert">Inside Front Cover Display Advert (Full Page - 136mm x 190mm)</option>
<option value="Inside Front Cover Display AdvertHalf">Inside Front Cover Display Advert (Half Page - 136mm x 93mm)</option>
<option value="Inside Back Cover Display AdvertFull">Inside Back Cover Display Advert (Full Page - 136mm x 190mm)</option>
<option value="Inside Back Cover Display AdvertHalf">Inside Back Cover Display Advert (Half Page - 136mm x 93mm)</option>
<option value="Full Page Display Advert">Full Page Display Advert (136mm x 190mm)</option>
<option value="Half Page Display Advert">Half Page Display Advert (136mm x 93mm)</option>
<option value="Quarter Page Display Advert">Quarter Page Display Advert (66mm x 93mm</option>
<option value="Eighth Page Display Advert">Eighth Page Display Advert (66mm x 44.5mm)</option>

                        </select>

第二个下拉列表中有一些java脚本会根据所选广告更改问题数量,但基本上与第一个框相同。

如果您需要我更具体,请在评论中提出要求。

1 个答案:

答案 0 :(得分:0)

你尝试过这段代码吗?

function valueChange() {

document.getElementById('subtotal').value=0.0;
document.getElementById('vat').value=0.0;
document.getElementById('total').value=0.0;
document.getElementById('cboIssues').value='Please select the number issues required';

}