我需要一些Greasemonkey脚本的帮助。我试图替换HTML文档中的一些文本,并从该网站中删除一个JavaScript函数。替换目标网页中的代码的脚本
我要重写的表达是needCaptcha: true
为needCaptcha: false
。我想将它删除HTML的这一部分:
checkConfig = {
empty : "Enter the characters in the image",
error : "Type the characters you see"
},
我用这个脚本,但它不工作:
{
document.body.innerHTML = document.body.innerHTML.replace('needCaptcha: true ', 'needCaptcha: false');
document.body.innerHTML = document.body.innerHTML.replace('checkConfig = {
empty : "Enter the characters in the image"/,
error : "Type the characters you see"'
},)
}
任何想法?
好的,非常感谢你的回答我什么更好我们正在尝试做的明白。但是,您的脚本无法使用,只要您可以访问网上订购网页,您就可以在这里找到网页,这并不容易。
我想验证码在当地检查,所以我们应该能够绕过使用JavaScript。
总之,在这里你有网站的部分代码作为参考:
script type="text/javascript">
var placeOrderConfig = {
rate : "0.95",
userType : "cnfm",
editAddressUrl : "mailing_address.htm",
editAddressUrlNoMember : "mailing_address_no_member.htm" ,
changeAddressUrl : "change_mailing_address.htm",
quickZoneUrl : "quickLoginRegister.htm?loginReturn=",
editAddressWinTitle : "Edit Shipping Address",
changeAddressWinTitle : "Change Shipping Address",
addAddressWinTitle : "Add New Shipping Address",
defaultMessage : "Please enter your message to the supplier here",
remoteCheckEmailUrl : "$usMyalibabaServer/user/join/CheckEmail.htm",
noMemberAction : "noMemberResult.htm" ,
needCheckCode: true },
productData = [[602092306,"wholesaleProduct","promotion_gaga","US","",1,"CPAM","14%3A173%23blue%3B5%3A100014064",200282334]],
quantityConfig = {
minErrorText : 'Please enter a Min. Order quantity that is <span id="min"></span> or more.',
maxErrorText : 'Please enter a number that is <span id="max"></span> or less.'
},
checkConfig = {
emptyErorText : "Enter the characters you see in the image",
errorText : "Type the characters you see in the picture"
},
backHistoryUrl = "";
</script>
我刚刚格式化了您发布的代码,第二个块在语法上无效。你确定这是你使用的确切代码吗? – bfavaretto
不要过多地关注我的用户脚本,这是一个糟糕的尝试来创建一个可行的脚本(当然,它不会)。 – Pcsl
我们确实需要看到目标页面才能理解这一点。链接到它。或者使用firefox保存页面,然后将htm文件粘贴到http://pastebin.com/并链接到该页面。 –