Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/84.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/github/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 我想通过下拉选择在文本框中输入文本_Javascript_Html - Fatal编程技术网

Javascript 我想通过下拉选择在文本框中输入文本

Javascript 我想通过下拉选择在文本框中输入文本,javascript,html,Javascript,Html,我有一个下拉列表,其中有一个项目列表。如果我在下拉列表中选择一个项目,它的相应值应填充在下拉列表下方的文本框中。 我试着这样想 下拉列表id=“StandardComment” text区域id=区域注释 areaComments.text=StandardComment.selectedindex.value 请帮忙 function transfereValue(){ ob = document.getElementById('StandardComment'); val = ob.valu

我有一个下拉列表,其中有一个项目列表。如果我在下拉列表中选择一个项目,它的相应值应填充在下拉列表下方的文本框中。 我试着这样想

下拉列表id=“StandardComment” text区域id=区域注释

areaComments.text=StandardComment.selectedindex.value

请帮忙

function transfereValue(){
ob = document.getElementById('StandardComment');
val = ob.value
document.getElementById('areaComments').value = val
}
在你的下拉列表中

<select id="StandardComment" onchange="transfereValue()">
<option value="blahh">Blah</option>
<option value="blahh2">Blah2</option>
<option value="blahh3">Blah3</option>
</select>

废话
废话
废话

像我创建的JSFIDLE这样的东西?它将自动插入您输入的值,然后选择文本框


例如,如果我从下拉列表中选择“发货”,它应该在文本区域中为我提供发货金额。希望我已经说清楚了,您使用的是框架,比如jQuery还是原型?还是你想要直的JS?