Yeah, I wasn't necessarily responding to your JavaScript errors, just
the ECS compile error you were getting. Here are a couple things to
check for your JavaScript problem:
1. Depending on your servlet engine you need to make sure that the
scripts.js file is in the correct location. If you are using Tomcat
you'll need to make sure that this file ends up in
$TOMCAT_HOME/webapps/appname/ or some subdirectory underneath there that
you would refer to in your Script() call.
2. Depending on what you're trying to do with your JavaScript code, I
find that the best place to load my javascript source is in the <head>
portion of my HTML file. It all depends on where you are trying to call
the script code. I may be mistaken, but I'm pretty sure that if you are
using a script for a <body onload=""> then you'll need to have that
script loaded as part of the <head>. To do that move your "scrolling"
variable into the Head() declaration:
.addElement(new Head()
.addElement(scrolling)
);
Hope that gets you close.
David
> -----Original Message-----
> From: Jeremy W. Redmond [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, July 12, 2001 3:22 PM
> To: [EMAIL PROTECTED]
> Subject: RE: Script() use in ECS
>
>
>
> That works, however, it must not have been my main problem.
> As you see in my original post I am using this code to
> declare my <script>
> tag:
>
>
> Script scrolling = new Script()
> ����������� .setLanguage("JavaScript")
> ����������� .setSrc("scripts.js");
>
> Somehow the page is not recognizing the src (scripts.js).
> I have also tried using the form
> "File://E://ecs//servlets//scripts.js"
> The <script src="scripts.js" language="javascript> is in the
> source of the HTML page, however, the < - - section is blank.
> I get a javascript error when I try to run. Any further help
> woould be greatly appreciated.
>
> Jeremy
>
>
>
>
> "David
>
> Ethell" To:
> <[EMAIL PROTECTED]>
> <dethell@sscd cc:
>
> inc.com> Subject: RE:
> Script() use in ECS
>
>
> 07/12/2001
>
> 10:48 AM
>
> Please
>
> respond to
>
> ecs-user
>
> +OK 0 0
>
>
>
>
>
>
>
>
> > Html html = new Html()
> > .addElement(new Head()
> > .addElement(new org.apache.ecs.html.Title("Entry Form")))
> > .addElement(new Body()
> > .setBgColor(HtmlColor.SILVER)
> > .addElement(today)
> > .addElement(scrolling)
> > .setOnLoad("scrollMsg()")
>
> > "Can't invoke a method on a Void"
>
> The setOnLoad method returns a void and the addElement method
> can only accept an object, not a void which is what gets
> returned if the final method for your Body object is
> setOnLoad. There are two ways around this.
>
> One is to use the addAttribute method to set your onLoad
> function instead of using the setOnLoad. I know it's not as
> intuitive, but as addAttribute returns Element instead of
> void you can use it. So your code would be:
>
> .addElement(new Body()
> .setBgColor(HtmlColor.SILVER)
> .addElement(today)
> .addElement(scrolling)
> .addAttribute("onLoad","scrollMsg()")
>
> The only other option is to first declare the Body section as
> it's own variable using one of the following two options:
>
> Body myBody = new Body();
> myBody.setBgColor(HtmlColor.SILVER);
> myBody.addElement(today);
> myBody.addElement(scrolling);
> myBody.setOnLoad("scrollMsg()");
>
> Or, as some prefer, declare all the parts of the body that
> return Body within the creation of the variable and set any
> attributes that return void or Element after the creation of
> the variable:
>
> Body myBody = (new Body()
> .setBgColor(HtmlColor.SILVER)
> .addElement(today)
> .addElement(scrolling)
> );
> myBody.setOnLoad("scrollMsg()");
>
> Hope that helps,
> David
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]