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>
援引一些
您需要发送什么?完成问题您需要发送什么?完成问题