【发布时间】:2017-02-23 00:17:29
【问题描述】:
在 Java 项目中,我使用 SWT Eclipse 作为浏览器。
我运行这个浏览器并加载页面正常。
加载的页面是这样的:
<!DOCTYPE html>
<html>
<body>
Start: <input type="text" id="startTimeField" onchange="myFunction()" placeholder="Type text and press Enter"> ms
<script>
function myFunction() {
document.getElementById('startTimeField').value = new Date().getMilliseconds();
}
</script>
</body>
</html>
我想在 Java 代码中监听页面中的元素。
示例我想要实现的目标:
在 Java 中按 JButton,它应该从页面中找到 ID 为 startTimeField 的按钮并向它们添加侦听器。侦听器应侦听此字段的更改值。这个怎么做 ?
【问题讨论】:
标签: javascript java html eclipse swt