Whats wrong with this script?
Okay… its nearly 4:30am and I’m seriously getting annoyed. Heres an example. I’ve changed it to make it really simple to follow, but you’ll get the idea. Code below the cut.
<script type="text/javascript" language="JavaScript">
<!--
function changeWoW() {
var main, paras;
main = document.getElementById("main");
paras = main.getElementsByTagName("p");
for (var i = 0; i < paras.length; i++) {
var str = paras[i];
var regex = /WoW/ig;
str = str.replace(regex,"World of Warcraft");
}
} // end changeWoW();
//->
</script>
Now, poor quality aside, why the hell is Firefox telling me the replace() method doesn’t exist when I know damn well that it most definitely does?
Maybe I’m just too damn tired and thats why this is starting to piss me off, but I cannot for the life of me see why something that has worked in the past is suddenly taking to ripping in to me. This is not a good thing. :-|
Update: Nevermind. Figured it out at about 7:45am after staying up the whole night thinking about it. Wasn’t till I turned on the computer to check something that I realised my mistake. Unbelievably simple solution.
Moral of the story… Don’t code when you’re exhausted. Especially when you’re gonna stay up all night trying to figure out the problems.
| Print article | This entry was posted by Steve on 31 December, 2005 at 3:18 am, and is filed under Uncategorized. Follow any responses to this post through RSS 2.0. You can leave a response or trackback from your own site. |
-
Steve
-
Steve
-
Steve
-
Steve
-
Mike
-
Mike
-
Steve
-
Steve