我想要的是,如果用户决定设置多个值,那么“下一步”按钮会获得指向不同页面的不同链接。
var singleMulticontainer = document.getElementById("singleMultiContainer");
var singleMultiValue = singleMultiContainer.options[singleMultiContainer.selectedIndex].value;
var nextButton = document.getElementById("nextButton");
var multipleSetWindow = "window.location='multiSet.html'"
if(singleMultiValue == "multi"){
nextButton.onclick = multipleSetWindow;
}
else{
alert("notworking");
}
HTML 片段:
<form id"suspendedProperties">
<p><h4>Select Station:
<select name="stationDropdown">
<option value="50028000">Tanama</option>
<option value="60008001">Example Riv1</option>
<option value="60008002">Example Riv2</option>
<option value="60008003">Example Riv3</option>
<option value="60008004">Example Riv4</option>
</select>
</h4></p>
<p>Select Sample Medium:
<select name="sampleMediumDropdown">
<option value="Wer">Wer</option>
<option value="WSQ">WSQ</option>
</select>
</p>
<p>Begin Date
<input type="date"/>
</p>
<p>Hydrologic Event: <select name="hydroEvent">
<option value="1">Example 1</option>
<option value="2">Example 2</option>
<option value="3">Example 3</option>
<option value="4">Example 4</option>
<option value="5">Example 5</option>
<option value="6">Example 6</option>
</select>
</p>
<p>Add:<input type="number" size=""/> <select name="singleMultiContainer"><option value="single">Single container sample</option><option value="multi">Multiple sets container</option></select></p>
<p>Analyses Requested:(Applies to all samples)<br/></p>
<div id="analyses" >
<input type="checkbox" name="analysis" value="C">Concentration</input>
<input type="checkbox" name="analysis" value="SF">Sand-fine break**</input>
<input type="checkbox" name="analysis" value="SA">Sand analysis**</input> <br/>
<input type="checkbox" name="analysis" value="T">Turbidity</input>
<input type="checkbox" name="analysis" value="LOI">Loss-on-ignition**</input>
<input type="checkbox" name="analysis" value="DS">Dissolve solids</input> <br/>
<input type="checkbox" name="analysis" value="SC">Specific conductance</input>
<input type="checkbox" name="analysis" value="Z">Full-size fractions**</input>
</div>
<input type="button" value="Back" onClick="window.location='SED_WE.html'"/>
<input type="button" value="Next" onClick="window.location='SampleInfo.html'"/>
</form>
所以最后两行是下一个和后退按钮。如果用户选择拥有多个集合容器,我想为下一个 Button 提供 multiSet.html 值。