문제

I'm trying to create a popup that displays the Price of FTC when the table loads using javascript. I'm running my script using GreaseMonkey in Firefox.

The site I'm running my code on is: https://www.coinmkt.com/#/ The code below does run the script once, but my innerHTML is undefined. Can anyone help me return the value of FTC? Thanks in advance:

function myScript(){
    if(document.getElementById('reverse-exchange-rates')){
        alert(document.getElementById('reverse-exchange-rates').getElementsByTagName('td')[5].getElementsByTagName('span')[0].InnerHTML);
        clearInterval(RunNewIteration);
    }
    var RunNewInteration = setTimeout(myScript, 5000);
}

myScript();
도움이 되었습니까?

해결책

It should be:

innerHTML

Not:

InnerHTML

The first letter must be small-case.

다른 팁

copy/paste this! innerHtml was wrongly spelled

function myScript(){
if(document.getElementById('reverse-exchange-rates')){
    alert(document.getElementById('reverse-exchange-rates').getElementsByTagName('td')[5].getElementsByTagName('span')[0].innerHTML);
    clearInterval(RunNewIteration);
}
var RunNewInteration = setTimeout(myScript, 5000);
}

 myScript();
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top