[Javascript] problem with swfobject.js

Nick Fitzsimons nick at nickfitz.co.uk
Mon May 15 21:16:21 CDT 2006


Oh dear, my mistake; let me correct myself here:

Nick Fitzsimons wrote:

> (typeof _20=="string")?document.getElementById(_20):_20
> 
> It doesn't work in your document because the 
> document contains no element (by which I mean the DOM Level 1 definition 
> of an Element) which has its "id" attribute set to the value "_20". I 
> can say this with absolute certainty even though I haven't seen the 
> document, because if the document contained an element with the id "_20" 
> then that element would be assigned to the variable "n" and would have a 
> (non-standard) innerHTML property, and the code would work.

I should of course have said "element having an ID attribute whose value 
is equal to the value of the variable named '_20', assuming that the 
type of the variable named '_20' is 'string'." Either way, if _20 
contains a string, that string doesn't match any ID attribute in the 
document; otherwise, _20's value is null or undefined, thus causing the 
error ("No properties" FF or "Object expected" IE) that you see.

Hopefully I've got it right this time :-)

Cheers,

Nick.
-- 
Nick Fitzsimons
http://www.nickfitz.co.uk/





More information about the Javascript mailing list