PeterBrunone:
No. That is wrong. Please read what LudovicoVan wrote above.
The "object expected" was being thrown because the way the event assignment is written, he is actually calling the spanCount function and assigning its return value to the onload attribute. Since event handlers don't work that way, and-- more importantly -- there is no value returned from the function, you get an "object expected" error.
The quotes do need to be matched correctly, but that is not what was causing the error mentioned in the original post.
This thread tells a nice story, for those who care reading of course. There is also a bit of irony i guess. :)
Peter, I didn't say that. I am quite good at skipping what is not my current concern and still "close the gaps", so to say. If I furtherly inspect the code, I would expect 2 errors actually: 1) The misquoting should make definition of the function fail along with all subsequent definitions in that SCRIPT, with a complain about unterminated string literal; 2) That should in turn lead to an error when the code invokes (and that is really error number 2, about misunderstanding references) a function that is not defined due to error 1. That might be giving "object expected", or rather "object undefined"... But, I still have made no test here, and that I guess would be the only serous way to give a detailed answer in similar cases, due to all the browsers idiosyncrasies we sadly know of.
Actually, my basic point was about being a bit more careful in giving answers!!! If we all look at it for more than few seconds, we would see that most people here do not even conceive the possibility of this being "programming", and "debugging" their scripts. Most do not even really know how to look at the errors the browser reports. Mostly simply cut-and-paste and let's see if I can hack it. So, another crusade maybe, yet I feel the need of it from times to times...
I would again stress a point that is largely misunderstood:
This:
<body onload="doSomething()">
is NOT equivalent to this:
body.onload = doSomething(); // Incorrect!!!
The correct way to pass a reference is this:
body.onload = doSomething;
Now you see, this is an instance of "closing the circle" while not getting into details. That is correct and can lead to any further correct argument, so that I am in a rock there, yet have not taken the time to say it all. Go study for that, or at least ask more...
But, but, but, that said, I must admit at the beginning, err... I simply didn't see/didn't care the misquoting - my under-brain knows! I actually misred RoamingLlama first post at all, as I thought he was suggesting single quotes in place of double quotes. I apologize for that! And, btw, you get the irony...
-LV
Julio P. Di Egidio
Software Analyst Programmer
=BUSINESS AND SCIENTIFIC=
=SOFTWARE DEVELOPMENT=
http://julio.diegidio.name
(Peace X Love] = [++1)