我有一个java脚本函数
function findInthePage(str)
{
// code
}
如何将 HTML 文本框的内容传递给上述函数? 我的按钮点击代码是
<input id="Text1" type="text" name="tb1" />
<input id="Button1" type="button" value="button" onclick="findInthePage(text1.value);" />
最佳答案
试试这个:
var text = document.getElementById('Text1').value
关于javascript - 如何在单击按钮时将 HTML 文本框的值(内容)传递给 javascript 函数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21545557/