Javascript 在函数js中传递变量

Javascript 在函数js中传递变量,javascript,function,Javascript,Function,我有密码: <td><input type="hidden" id="someText" name="someText" value="Hello World!"> </td> <td><button onclick="test(document.getElementById('someText'))">Invoke Some</button></td> 援引一些 我想向我的测试()传递一些文本。但是我得

我有密码:

<td><input type="hidden" id="someText" name="someText" value="Hello World!">  </td>
<td><button onclick="test(document.getElementById('someText'))">Invoke Some</button></td>

援引一些
我想向我的测试()传递一些文本。但是我得到了[object HTMLInputElement]。
我必须在html中传递它no in

如果要传递元素对象,则需要访问其

<td><button onclick="test(document.getElementById('someText').value)">Invoke Some</button></td>


如果要传递元素对象,则需要访问其

<td><button onclick="test(document.getElementById('someText').value)">Invoke Some</button></td>


使用div的id获取其中的,并将其传递给函数

<input type="hidden" id="someText" name="someText" value="Hello World!">  </td>
<td>
    <button onclick="test(document.getElementById('id of your div').value)">Invoke Some</button>
</td>

援引一些

使用div的id获取其中的,并将其传递给函数

<input type="hidden" id="someText" name="someText" value="Hello World!">  </td>
<td>
    <button onclick="test(document.getElementById('id of your div').value)">Invoke Some</button>
</td>

援引一些

您需要发送什么?完成问题您需要发送什么?完成问题