From: Marc G. <mgu...@ya...> - 2004-12-01 08:41:18
|
Robert, Your js code was correct, the interpretation by htmlunit is wrong and it's not IE specific, it's standard: getElementsByTagName should return a NodeList and NodeList should have a method item(int): http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-one-core.html#ID-A6C9094 http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-one-core.html#ID-536297177 Marc. PS: you can write your changed js code in one line ssnTableRows[i].getElementsByTagName("td")[1].style.backgroundColor="white"; Brehm, Robert P wrote: > Marc, > > Thanks for the hint! I did some further research on getElementsByTagName, and I discovered that it returns an array which in strict Javascript requires the [] notation. The following change worked: > > ssnTableRows[i].getElementsByTagName("td").item(1).style.backgroundColor="white"; > to > var tdElements = ssnTableRows[i].getElementsByTagName("td"); > tdElements[1].style.backgroundColor = "white"; > > I guess I was using JScript notation and the Rhino engine correctly did not process. > > Regards, > > Bob Brehm > > -----Original Message----- > From: htm...@li... > [mailto:htm...@li...]On Behalf Of Marc > Guillemot > Sent: Wednesday, November 24, 2004 6:28 AM > To: htm...@li... > Subject: Re: [Htmlunit-user] JavaScript question > > > sorry, I've read this to fast and I was thinking about double access syntas with () and []. > > Marc.. > > Mike Bowler wrote: > >>Marc Guillemot wrote: >> >> >>>this can probably be fixed making the object returned by >>>"getElementsByTagName("td")" both a "normal" object and object >>>implementing interface org.mozilla.javascript.Function as I've done it >>>for document.all. >> >> >> >>I'd read the question as "can I generically tell HtmlUnit to not throw >>exceptions when it hits javascript it can't handle" and I still don't >>know how that would be done. Perhaps if we caught the exceptions in >>executeJavaScriptIfPossible() and then ignored them if the user had >>specified "suppress javascript exceptions" or something similar. >> >> > > > > > ------------------------------------------------------- > SF email is sponsored by - The IT Product Guide > Read honest & candid reviews on hundreds of IT Products from real users. > Discover which products truly live up to the hype. Start reading now. > http://productguide.itmanagersjournal.com/ > _______________________________________________ > Htmlunit-user mailing list > Htm...@li... > https://lists.sourceforge.net/lists/listinfo/htmlunit-user > > > ------------------------------------------------------- > SF email is sponsored by - The IT Product Guide > Read honest & candid reviews on hundreds of IT Products from real users. > Discover which products truly live up to the hype. Start reading now. > http://productguide.itmanagersjournal.com/ |