Javascript GreaseMonkey如何在google文档上键入文本

Javascript GreaseMonkey如何在google文档上键入文本,javascript,greasemonkey,Javascript,Greasemonkey,嗨,我在用greasemonkey,我在想我怎样才能让它输入一些“你好,这是一个自动类型”。我想尝试在谷歌文档上这样做,但它不起作用。我粘贴在下面的代码在google.com上工作 var input=document.createElement("input"); input.type="button"; input.value="Start.auto"; input.onclick = buttononclick; input.setAttribute("style", "font-size

嗨,我在用greasemonkey,我在想我怎样才能让它输入一些“你好,这是一个自动类型”。我想尝试在谷歌文档上这样做,但它不起作用。我粘贴在下面的代码在google.com上工作

var input=document.createElement("input");
input.type="button";
input.value="Start.auto";
input.onclick = buttononclick;
input.setAttribute("style", "font-size:18px;position:absolute;top:120px;right:130px;");
document.body.appendChild(input); 

function buttononclick()
{
    if(window.location.href.indexOf("q=") < 0) //To avoid recursion
{
    var inputs = document.getElementsByTagName("input");
    for(var i=0;i<inputs.length;i++)
    {
        if(inputs[i].type == "text")
        {
            inputs[i].value = "AutoType";
        }
    }
    //Submit form
    document.forms[0].submit();
}
}
var input=document.createElement(“输入”);
input.type=“按钮”;
input.value=“Start.auto”;
input.onclick=按钮非单击;
setAttribute(“样式”,“字体大小:18px;位置:绝对;顶部:120px;右侧:130px;”);
document.body.appendChild(输入);
函数ButtonNonclick()
{
if(window.location.href.indexOf(“q=)<0)//避免递归
{
var inputs=document.getElementsByTagName(“输入”);

对于(var i=0;i你在谷歌文档上的意思是什么…我的意思是我希望脚本在谷歌文档上键入“Hello This is automated”。你的代码做什么?我希望我的代码能够使用greasemonkey将“This is automated”写入谷歌文档文件。现在,我与你们共享的代码将键入“重新输入谷歌并提交。