I’m a javascript newer than newbie. I’m trying to write a script (for greasemonkey) that will continuously check the contents of a div for changes.
Thru a little searching and hours of trial and error I’ve got this to work…
[code]
divstate = (document.getElementById(‘state’).innerHTML);
alert(divstate);
It works and will pop up the contents of the div with the ID state, once.
Everytime I try to stick it in a loop, it either pops up regardless of what’s in the div, or creates an endless loop that crashes my browser.
[code]
var endvalue = “OFF”
while (document.getElementById(‘state’).innerHTML != endvalue) {
divstate = (document.getElementById(‘state’).innerHTML);
if (divstate = endvalue) {
alert(divstate);
}
}
I have tried a do while too but get the same results.
What am I doing wrong?