我有一个简单的表单,可以接受来自弹出表单的输入(用户单击Contour):https://codepen.io/alabamarob/pen/JjGYVjr。用户可以从代表偏斜的图形中选择他们希望输入数字跨日期分布的方式。
我想做的是根据所选的分布曲线和ETC量填充“调整”文本字段。例如,如果用户选择了第一条曲线,那么ETC数量字段中的任何数量都将被分配10%25%65%并相应地填充调整字段。同样,正态分布将填充20%60%20%的量。
任何指针都会有所帮助。谢谢!
//this is the main page
<table><tr><td>
<A HREF="skew.html" onClick="return popup(this, 'notes')">Contour</a>
</td>
<td> <input name="0" type="text" />
</td>
<td> <input name="1" type="text" />
</td>
<td> <input name="2" type="text" />
</td>
</tr>
</table>
<br/>
//this is the popup page
<table>
<tr><td>Choose Countour: <input type="radio" name="skew0" value="neg">
<img src="imgs/0.jpg" width="20px"></td>
<td align="center"><input type="radio" name="skew0" value="pos">
<img src="imgs/1.jpg" width="20px"></td>
<td ><input type="radio" name="skew0" value="no">
<img src="imgs/2.jpg" width="20px"></td>
</tr>
<tr><td>ETC Total Value:</td><td colspan="2" align="right"> <input type="textbox" ></td></tr>
<tr><td colspan="3" align="right"><input type="submit" value="submit" onclick="self.close()"></td></tr></table>```
答案 0 :(得分:0)
<script type="text/javascript">
function copy()
{
if(document.getElementById('neg').checked) {
var n1 = document.getElementById("n1");
var n2 = document.getElementById("n2");
var n3 = document.getElementById("n3");
var n4 = document.getElementById("n4");
n2.value = n1.value*.4;
n3.value = n1.value*.5;
n4.value = n1.value*.1;
}
if(document.getElementById('pos').checked) {
var n1 = document.getElementById("n1");
var n2 = document.getElementById("n2");
var n3 = document.getElementById("n3");
var n4 = document.getElementById("n4");
n2.value = n1.value*.1;
n3.value = n1.value*.7;
n4.value = n1.value*.4;
}
if(document.getElementById('no').checked) {
var n1 = document.getElementById("n1");
var n2 = document.getElementById("n2");
var n3 = document.getElementById("n3");
var n4 = document.getElementById("n4");
n2.value = n1.value*.15;
n3.value = n1.value*.7;
n4.value = n1.value*.15;
}
}
</script>
<table border="0" style="background-color: #ffffff; filter: alpha(opacity=40); opacity: 0.95;border:1px black solid;">
<tr>
<td>Enter ETC and Choose Contour: </td>
<td><input type="text" name="n1" id="n1"></td>
<td><input type="radio" name="skew0" id="pos"><img src="imgs/0.jpg" width="20px"></td>
<td align="center"><input type="radio" name="skew0" id="no"><img src="imgs/1.jpg" width="20px"></td>
<td ><input type="radio" name="skew0" id="neg">
<img src="imgs/2.jpg" width="20px"></td>
<td><input type="button" value="Go!" onClick="copy();" /></td>
</tr>
</table>
<br/>
<table border="0"><tr>
<td> </td>
<td>8/21/20</td>
<td>9/25/20</td>
<td>10/30/20</td>
<td></td>
</tr>
<tr> <td>Adjustments:</td><td><input type="text" name="n2" id="n2"/></td><td><input type="text" name="n3" id="n3"/></td><td><input type="text" name="n4" id="n4"/></td><td></td></tr>
</table>