I have this javascript code that is supposed to be refreshing a given web page after a specific amount of time and tries to find a certain word after each refresh. And when that word is found, a certain alarming sound is supposed to go off. here's the code:
javascript: var myRegExp = prompt("the word"); timeout = prompt("the time in seconds"); current = location.href; setTimeout('reload()', 1000 * timeout); var audio = new Audio('http://soundbible.com/grab.php?id=2197&type=mp3'); function reload() { var found = searchText(); if (!found) { setTimeout('reload()', 1000 * timeout); fr4me = '<frameset cols=\'*\'>\n<frame id="frame01" src=\'' + current + '\'/>'; fr4me += '</frameset>'; with(document) { write(fr4me); void(close()) }; } } function searchText() { var f = document.getElementById("frame01"); if (f != null && f.contentDocument != null) { var t = f.contentDocument.body.innerHTML; var matchPos = t.search(myRegExp); if (matchPos != -1) { audio.play(); return true; } else { return false; } } } My question/request is, how to make the search for the word case insensitive?
f.contentDocument.body.innerHTML.toLowerCase()