我有一个html表单,我需要解析服务器端的信息(这是我编写的一个简单的HTTP Java服务器),以便运行带有这些选项的程序。不幸的是,当我提交表单时,它不包括所有输入选项,只显示它们的一个子集,例如/run.html?-z=-w&yse=yse1&tracefile=capacity.1Mbps_c50.txt
。还有其他表单项(例如数字框fd
,rd
,per
等)未包含在内。有人可以帮助我吗? (实际上未包含的内容应为visible
,除非选中Use a sample tracefile
复选框。
您可以在此处查看演示:http://jsfiddle.net/3at2c/10/
这是整个HTML代码(记住,如果你想修改JavaScript,请不要使用JQuery;一切都应该写在一个文件中)
<html>
<head>
<script type="text/javascript">
var isTrace = document.getElementById('isTracefile');
var ctTrace = document.getElementById('cttracefile');
var custom = document.getElementById('custom');
isTrace.onchange = function(){
if (!isTrace.checked) {
ctTrace.style.display = "none";
custom.style.display = "block";
} else {
custom.style.display = "none";
ctTrace.style.display = "block";
}
};
</script>
</head>
<body>
<p>
<h3>Please select a configuration below to run the emulator with:</h3>
<form action="run.html" method="GET">
<input type="checkbox" name="-w" value="-w"/>[-w]: wrap around at tracefile end and begin anew at time zero./
<br/>
<input type="checkbox" name="-z" value="-w"/>[-z]: zero packets routed through; route to co-resident webserver
<br/>
<input type="checkbox" name="-b" value="-b"/>[-b]: run the emulator in the background.
<br/>
<br/> YSE Emulator to Run: <select name="yse">
<option value="yse1">YSE1</option>
<option value="yse2">YSE2</option>
<option value="yse3">YSE3</option>
<option value="yse4">YSE4</option>
<option value="yse5">YSE5</option>
<option value="yse6">YSE6</option>
</select> <br/>
<br/>
<input type="checkbox" id="isTracefile" checked />Use a sample tracefile
<!--Wrap the select and its label in a container so that it can be shown/hidden-->
<div id="cttracefile">
Sample Tracefiles to use:
<select name="tracefile">
<option value="capacity.1Mbps_c50.txt">capacity.1Mbps_c50</option>
<option value="capacity.3Mbps_100RTT_PER_0.00001.txt">capacity.3Mbps_100RTT_PER_0.00001</option>
<option value="capacity.3Mbps_100RTT_PER_0.0001.txt">capacity.3Mbps_100RTT_PER_0.0001</option>
<option value="capacity.3Mbps_100RTT_PER_0.001.txt">capacity.3Mbps_100RTT_PER_0.001</option>
<option value="capacity.3Mbps_100RTT_PER_0.01.txt">capacity.3Mbps_100RTT_PER_0.01</option>
<option value="capacity.3Mbps_100RTT_PER_0.05.txt">capacity.3Mbps_100RTT_PER_0.05</option>
<option value="capacity.3Mbps_100RTT_PER_0.1.txt">capacity.3Mbps_100RTT_PER_0.1</option>
<option value="capacity.3Mbps_200RTT_PER_0.0001.txt">capacity.3Mbps_200RTT_PER_0.0001</option>
<option value="capacity.3Mbps_200RTT_PER_0.001.txt">capacity.3Mbps_200RTT_PER_0.001</option>
<option value="capacity.3Mbps_400RTT_PER_0.0001.txt">capacity.3Mbps_400RTT_PER_0.0001</option>
<option value="capacity.3Mbps_400RTT_PER_0.001.txt">capacity.3Mbps_400RTT_PER_0.001</option>
<option value="capacity.13Mbps_200RTT_PER_0.000001.txt">capacity.13Mbps_200RTT_PER_0.000001</option>
</select>
</div>
<!--Wrap the custom inputs and its labels in a container so that it can be shown/hidden-->
<div id="custom">
<label>Forward Delay: </label><input id="fd" type="number" min="0" max="1000" step="1" value ="100"/> ms
<br/>
<label>Reverse Delay: </label><input id="rd" type="number" min="0" max="1000" step="1" value ="100"/> ms
<br/>
<label>Download Capacity: </label><input id="down" type="number" min="1" max="30" step="1" value ="1"/> MBps
<br/>
<label>Upload Capacity: </label><input id="up" type="number" min="1" max="30" step="1" value ="1"/> MBps
<br/>
<label>Packet Error Rate (PER): </label><input id="per" type="number" min="0.00001" max="1" step="0.00001" value ="0.00001"/>
</div>
<br/> <input type="submit" value="Run Emulator!"/>
</form>
</body>
</html>