我正在构建一个应用程序;基本功能是根据键值填充包含对象的列表。然后为此填充一个空白文本框...这一切都很好。我想要做的是...使用相同的文本框来添加/删除用户输入到函数。所以它可以存储和访问。我需要朝着正确的方向努力。是否值得存储在函数中的单独数据数组中...我一直在寻求帮助。而且我在使用json,保存在字典中之间徘徊。
下面将介绍我的脚本中的机制。
<script>
function populate(s1,s2){
var s1 = document.getElementById(s1);
var s2 = document.getElementById(s2);
s2.innerHTML = "";
if(s1.value == "FMIP"){
var optionArray = ["|","FMIP Object 1|FMIP"];
for(var option in optionArray){
var chris = optionArray[option].split("|");
var chris2 = document.createElement("option");
chris2.value = chris[0];
chris2.innerHTML = chris[1];
s2.options.add(chris2);
}
}
</script>
<select id="slct1" name="slct1" class="tbox4"
onchange="populate(this.id,'slct2')">
<option value=""></option>
<option value="FMIP">FMIP</option>
<select id="slct2" name="slct2" class="tbox3"
onchange="document.form.ShowValue2.value=this.value">
<!--- In this box below i would like to INPUT data... and for it to be
submitted and saved into my script (populate) function. So it is
callable from 'slct1' list. I also plan to be able to delete the data
I know I'm probably going to have to restructure the code. And add a few
buttons for 'onclick' commands --->
<textarea name="ShowValue2" cols="40" rows="5" class="tbox"></textarea>
我显然是新手,所以和我在一起。但我所需要的只是朝着正确的方向努力。谢谢你