【发布时间】:2017-08-10 19:03:10
【问题描述】:
我有以下代码:
我想要做的是当我输入提示时,我希望能够输入多个变量并接收它们的输出。我该怎么做呢。
比如我输入lh0、lh1和lh3,我期望得到000110100110010111101
var outputRef = document.getElementById('outputArea');
var output = " ";
var areas = prompt("Enter no : ");
var areas1 = {
lh0 : "0001101",
lh1 : "0011001",
lh2 : "0010011",
lh3 : "0111101",
lh4 : "0100011",
lh5 : "0110001",
lh6 : "0101111",
lh7 : "0111011",
lh8 : "0110111",
lh9 : "0001011"
};
if (areas1 [ areas ] !== undefined)
{
areas = areas1[areas];
}
output = areas;
outputRef.innerHTML = output;
谢谢!
【问题讨论】:
-
请准确添加您想要输入的内容以获得想要的结果。你有考虑过使用循环吗?
-
“你想输入什么以获得想要的结果”到底是什么意思。我已经说过,使用提示符,我将键入 lh0 等等。我考虑过使用循环,但我不知道如何去做
-
好吧,你可以写第一个,输入,然后是下一个,tec 或 jusit in one,用空格或逗号分隔,或其他。那么如何将想要的信息输入到单个(?)提示符中?
-
还有伊丽莎,也刚刚在这里回答了……老实说,你真的想要那个突然出现在你的脸上(提示)吗?你不能使用“html select multiple”或者只是一个普通的“文本框”
标签: javascript string object var