In comp.lang.javascript message <48*********************@news.orange.fr>
, Tue, 13 May 2008 18:17:01, SAM <st*********************@wanadoo.fr.inv
alidposted:
>
if(document.getElementsByTagName("body")[0] &&
document.getElementsByTagName("body")[0].hasAttribute &&
document.getElementsByTagName("body")[0].hasAttribute('style') )
alert(document.getElementsByTagName("body")[0].getAttribute('style'));
I think the following might work more efficiently :-
if ( (T=document.getElementsByTagName("body")[0]) &&
(T=TT.hasAttribute) && (T=T('style')) ) alert(T);
// ^ ?
Certainly there should be no need to repeat
document.getElementsByTagName("body")[0].hasAttribute('style')
except for those paid for code by the yard.
--
(c) John Stockton, nr London, UK. ?@merlyn.demon.co.uk Turnpike v6.05 MIME.
Web <URL:http://www.merlyn.demon.co.uk/- FAQish topics, acronyms, & links.
Proper <= 4-line sig. separator as above, a line exactly "-- " (SonOfRFC1036)
Do not Mail News to me. Before a reply, quote with ">" or "" (SonOfRFC1036)