【问题标题】:Changing the content of a text area with grease monkey用油脂猴改变文本区域的内容
【发布时间】:2014-03-05 12:11:48
【问题描述】:

这是我使用的脚本:

var textarea = document.getElementsById("commentBodyField");
textarea.value = "Hello";

当我激活greasemonkey 并刷新页面时,文本区域没有任何变化。 我通过浏览器检查元素功能获得了文本区域 id (commentBodyField)

【问题讨论】:

    标签: javascript


    【解决方案1】:

    函数调用getElementById,而不是Element*s*。

    【讨论】:

    • @user3383133:你检查过脚本是否运行了吗?例如通过运行alert()console.log()。您可能还想检查何时该脚本由greasemonkey 运行。
    • 是的,警报有效,所以我的问题是,网页上是否有某种保护措施可以阻止此类脚本工作? (以反垃圾邮件机器人为例)
    猜你喜欢
    • 2012-02-17
    • 1970-01-01
    • 2012-03-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-03-31
    • 2013-09-18
    • 2016-10-23
    相关资源
    最近更新 更多