[英]Uncaught TypeError: string is not a function and there are no functions with the same name
[英]Same name for a string and a function
現在我有一個嚴重的腦放屁。 我有這個功能:
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
}
}
}
別擔心它不是真正的病毒!!! 這是一個名為 slave hack 的游戲的機器人 - 用於學習目的
無論如何,當我調用函數時:
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,但我真的很想弄清楚我做錯了什么。
提前致謝!
您正在命名一個 URL 變量和一個具有相同名稱的函數: uplodeVirus
由於在您嘗試調用函數之前變量已初始化為保存字符串,因此調用uplodeVirus()
與調用("")()
。 這沒有任何意義,因為字符串不是函數。
嘗試更改其中一個的名稱。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.