现在我有一个大脑屁。我有这个功能:
function uplodeVirus(){
console.log('working')
console.log('uplodeVirus')
var form = document.getElementsByTagName('form')[1]
console.log(form)
var select = form.children[0]
console.log(select)
for (x in select) {
var lN = select[x].innerHTML // var linkName
if (lN == "vspam 0.3 [OpenRelay-backdoor.vspam ] (0.003 Gb)"){
value = select[x].value
select[x].setAttribute("selected", "selected");
form.submit()
break
}
}
}
不要担心它不是真正的病毒!这是一款名为奴隶黑客的游戏机器人 - 用于学习目的
无论如何,当我调用函数时:
var ip = '2.2.2.2'
var uplodeVirus = 'http://www.slavehack.com/index2.php?page=internet&var2=' + ip + '&var3=files&aktie=upload'
var currentUrl = window.location.href
console.log(currentUrl)
console.log(uplodeVirus)
if (currentUrl == uplodeVirus) { //Yes, I made sure that currentUrl = uplodeVirus
uplodeVirus()
}
什么都没发生......但如果我从代码中取出代码并执行此操作:
if (currentUrl == uplodeVirus){
console.log('working')
console.log('uplodeVirus')
var form = document.getElementsByTagName('form')[1]
console.log(form)
var select = form.children[0]
console.log(select)
for (x in select) {
var lN = select[x].innerHTML // var linkName
if (lN == "vspam 0.3 [OpenRelay-backdoor.vspam ] (0.003 Gb)"){
value = select[x].value
select[x].setAttribute("selected", "selected");
form.submit()
break
}
}
}
有效!!!现在,我可以选择B,但我真的想弄清楚我做错了什么。
提前致谢!
答案 0 :(得分:1)
您正在命名URL变量和具有相同名称的函数:/
由于在尝试调用函数之前初始化变量以保存字符串,因此调用uplodeVirus
与调用uplodeVirus()
相同。它没有任何意义,因为字符串不是函数。
尝试更改其中一个的名称。