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                                                           
    
                                                                                       
    
                                                                                       
    




> 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]

Reply via email to