`嘿伙计们。我正在创建一个程序,允许用户将数据输入文本框,然后将数据传递到不同的函数并返回结果以用于测试目的。
它们中的大多数都可以工作,但是我在使用包含 2 个或更多变量的函数传递数据时遇到了麻烦。
多参数函数只会打印第一个函数,然后停止。其余的工作正常。
这是一个例子
代码 :
function testOne(1)
{}
function testTwo(1,2)
{}
function testThree(1,2,3)
{}
function printTests()
{
document.writeln("testOne" + testOne(inputOne.value)) //Works fine
document.writeln("testTwo" + testTwo(inputOne.value, inputTwo.value)) //Stops here
document.writeLn("testThree" + testThree(inputOne.value, inputTwo.value,
inputThree.value)) //doesnt work, it stops at whatever method has 2 variables, prints it and then stops.
}
我的输入看起来像这样。
<input type="text" id="inputOne">
<input type="text" id="inputTwo>
<input type="text" id="inputThree">
所以基本上我只希望我的文本值通过每个方法传递,并在单击按钮时显示返回。但是,如果该函数接受 2 个或更多变量,则它不起作用,因为它会正确打印该函数,但不会打印它后面的函数。
任何想法为什么?提前谢谢你,如果我犯了一个粗心的错误,我很抱歉,这是我的第一个问题,我是 Script 新手。
谢谢!