|
From: DEMATTEIS, M. S [AG-Contractor/1000]
<mar...@mo...> - 2003-01-10 17:42:57
|
Please substitute this for my previous e-mail on the subject.
> -----Original Message-----
> From: DEMATTEIS, MARK S [AG-Contractor/1000]
> Sent: Friday, January 10, 2003 11:30 AM
> To: 'htm...@li...'
> Subject: onLoad Exception
>
> An exception is thrown when an onLoad handler accesses a form. Are there
> plans to change this in a future release?
>
> Exception
> ---------------
> Exception in thread "main" com.gargoylesoftware.htmlunit.ScriptException:
> "myForm" is not defined.
> at
> com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.execute(JavaScri
> ptEngine.java:162)
> at
> com.gargoylesoftware.htmlunit.html.HtmlPage.executeScriptTagsIfNeeded(Html
> Page.java:748)
> at
> com.gargoylesoftware.htmlunit.html.HtmlPage.initialize(HtmlPage.java:102)
> at
> com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:318)
> at
> com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:238)
> at
> com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:180)
> at Test.testOnload(Test.java:37)
> at Test.execute(Test.java:29)
> at Test.main(Test.java:18)
>
> Code:
> -------------------------
> void testOnload() throws java.net.MalformedURLException,
> java.io.IOException
> {
> String myUrl = "http://localhost:/page4.html";
> WebClient webClient = new WebClient();
> HtmlPage page = (HtmlPage) webClient.getPage(new URL(myUrl));
> }
>
> HTML Page
> ----------------------
>
> <html>
> <head>
> <title>Fourth Page</title>
> </head>
>
> <body onload = "changeValue()" >
> <form action="" method="POST" id="myForm" >
> <input type="text" name="myText" >
>
> <script type="text/javascript" language="JavaScript">
> s1 = new String(myForm.myText.value)
>
> function changeValue() {
> s1 = "Hello!"
> myForm.myText.value = s1.toUpperCase()
> }
>
> </script>
> </form>
> </body>
> </html>
>
> Mark Dematteis
|