0
我有一個3選擇題的形式。根據每個問題的選擇,問題將導致5頁(url)之一。提交到網址與多個輸入的形式
我在這裏搜索了一個類似的情況下工作的JavaScript,但腳本不能在我的網站工作。
我的表單代碼:
<fieldset id="second">
<h3 class="mbot_0"><label>How many miles does your auto have</label>
</h3>
<select id="mileage" data-hint="" name="mileage">
<option id="m1" selected value="0-15,000">
0-15,000
</option>
<option id="m2" value="15,001-30,000">
15,001-30,000
</option>
<option id="m3" value="30,001-65,000">
30,001-65,000
</option>
<option id="m4" value="65,001-100,000">
65,001-100,000
</option>
<option id="m5" value="100,000+">
100,000+
</option></select>
<h3 class="mbot_0"><label>Does your car have a GDI engine?</label></h3>
<select id="gdi" data-hint="" name="gdi">
<option id="" selected value="--">Select one
</option>
<option id="" value="yes">Yes</option>
<option id="" value="no">No</option>
</select>
<h3 class="mbot_0"><label>Do you use top-tier fuel when you fill up?</label></h3>
<select id="fuel" >
<option id="" selected value="--">Select one
</option>
<option id="" value="yes">Yes
</option>
<option id="" value="no">No
</option>
</select>
<input id="pre_btn1" onclick="prev_step1()" type="button" value="Previous">
<input type="submit" id="calculate"
value="Calculate" onclick="replace()"/>
</fieldset></form>
和我的劇本是
function replace() {
if (document.getElementById('mileage').value == '0-15,000' && document.getElementById('gdi').value == 'yes' && document.getElementById('fuel').value == 'yes') {
window.location = 'http://www.arnolfodesign.com/clients/itw_carbonator/outcome01.html';
} else if (document.getElementById('mileage').value == '0-15,000' && document.getElementById('gdi').value == 'yes' && document.getElementById('fuel').value == 'no') {
window.location = 'http://www.arnolfodesign.com/clients/itw_carbonator/outcome02.html';
}
}
</script>
我學習JavaScript,我去。請問,我在劇本中遺漏了什麼?
控制檯在打印if語句中的元素時說什麼? –
我不確定你在問什麼。但是,Firefox開發人員工具不會報告任何問題。鏈接返回到原始屏幕。 btw ...該網站是在這裏[鏈接](arnolfodesign.com/clients/itw_carbonator/autoTest.html) – Arnolfo
btw ...該網站位於: http://arnolfodesign.com/clients/itw_carbonator/autoTest。 HTML – Arnolfo