Menu

#895 ReferenceError: a defined function is considered undefined

closed
None
5
2012-10-21
2009-09-01
No

A page at http://dhtml-menu.com/examples/ex3-dhtml-drop-down-menu.html contains a DHTML menu.
Each menu item is provided with an onclick handler, which is a JS function name. This function is defined in foreign file, linked under HTML HEAD:

<script type="text/javascript" language="JavaScript1.2" src="apymenu.js"></script>

<script type="text/javascript" language="JavaScript1.2" src="data3.js"></script>

For instance, element with id=apy0m5i0I has the following action: onclick="lIIIa(event,"apy0m5i0I");"
This function is defined in apymenu.js file.
But, click() method invocation on such element leads to the following exception:
EcmaError: lineNumber=[1] column=[0] lineSource=[<no source="">]</no> name=[ReferenceError] sourceName=[JavaScriptStringJob] message=[ReferenceError: "IllIa" is not defined. (JavaScriptStringJob#1)]
com.gargoylesoftware.htmlunit.ScriptException: ReferenceError: "IllIa" is not defined. (JavaScriptStringJob#1)

I've attached a source file which reproduces the error.

It is weird, but HtmlUnit eventually loads the referred page. Please, let me know if this error is relevant to HtmlUnit... And take my apologies if it is not

Thanks

Discussion

  • tar-mynastyr

    tar-mynastyr - 2009-09-01

    Source code to produce the behaviour

     
  • Ahmed Ashour

    Ahmed Ashour - 2009-09-19

    With latest snapshot, this case works for me.

    Please get it from http://build.canoo.com/htmlunit/artifacts, and advise if you have any issue

     
  • tar-mynastyr

    tar-mynastyr - 2009-09-21

    Now this works for me either.
    Thank you

     

Log in to post a comment.

MongoDB Logo MongoDB