PDA

View Full Version : error in text file?



tim.thelion
08-05-2006, 07:41 PM
http://mysite.verizon.net/res8szeo/reader has three javascript errors in text files and I just can't figure out why.

shachi
08-05-2006, 07:44 PM
What do you do with responseText then??

tim.thelion
08-05-2006, 08:32 PM
what do you mean?
I split it. then I put it in an array.
then I search the array
but the errors are in the text files themselves. (I am using firefox)

Twey
08-05-2006, 11:17 PM
Opera tells a different story:
JavaScript - http://mysite.verizon.net/res8szeo/reader/
Inline script thread
Error:

name: TypeError

message: Statement on line 15: Could not convert undefined or null to object
Backtrace:
Line 15 of linked script http://mysite.verizon.net/res8szeo/reader/reader.js

while (! (words[i].indexOf(currentword.innerHTML + " ") === 0))
Line 6 of inline#1 script in http://mysite.verizon.net/res8szeo/reader/

definecurrentword();

while(!(words[i].indexOf(currentword.innerHTML+" ") === 0))
{
i++;
if(i===words.length)break;
}That should be:
while(!(words[i].indexOf(currentword.innerHTML+" ") === 0))
{
i++;
if(i===words.length-1)break;
}Even better, use a for loop:
for(var i = 0; i < words.length && words[i].indexOf(currentword.innerHTML.toString() + " ") !== 0; ++i) {}

tim.thelion
08-05-2006, 11:57 PM
I made some changes. It would apeare that the getellementbyid function is returning null for some reason. so as you can see, I played around with that a bit, with no luck though. now I am really confuses, because opera is giving me errors in commented out code.