我正在尝试通过Firefox的Greasemonkey向聊天室提交消息。网页上没有按钮,必须使用Enter键发送消息。检查聊天输入字段,出现:
<input type="text" id="chatcli" placeholder="type chat message here" onkeyup="if(event.keyCode == 13) ChatClient.sendLine();">
我可以使用document.getElementById('chatcli').value = "/bot command here"+x
编辑文本框,但不知道如何实际发送。
我注意到,如果我在控制台中输入ChatClient.sendLine();
,则会发送该消息。我尝试将该代码放入我的Greasemonkey脚本中,但是没有用。我也尝试过document.ChatClient.sendLine();
,什么也没做。
必须有一种方法可以将控制台命令发送到网页。我想念什么? 如果有人能指出我正确的方向,我将不胜感激。