Overview | Package | Class | Use | Tree | Deprecated | Index | Help
|  | BEA Systems, Inc.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

WebLogic Server 6.0sp2 API Reference

## weblogic.html
Class ScriptElement

    java.lang.Object
      |
      +--weblogic.html.HtmlElement
            |
            +--weblogic.html.ElementWithAttributes
                  |
                  +--weblogic.html.SinglePartElement
                        |
                        +--weblogic.html.ScriptElement

public class ScriptElement
extends SinglePartElement

Use a ScriptElement to add a JavaScript script to an HtmlPage.

The following example adds a ScriptElement to the HtmlPage "hp" to implement a simple Java script.

       hp.addElement(new ScriptElement("function compute(form) {" +
          "  if (confirm(\"Evaluate Expression \" + form.input.value + \" ?\")) " +
          "  form.answer.value = \"The answer is: \" + eval(form.input.value); " +
          "  else " +
          " alert(\"Try again and choose OK.\"); " +
          "}"));

You can also add a reference to a script kept in a file that is named in the setSrc() method. In this case, choose the constructor that takes no arguments.

Author:
  Copyright (c) 1995-96, WebLogic, Inc.
  Copyright © 2001 BEA Systems, Inc. All Rights Reserved.
See Also:
  `NoScriptElement`

Fields inherited from class weblogic.html.HtmlElement
`codeset, useObsolete`

Constructor Summary
`ScriptElement()` Deprecated. Constructs a ScriptElement without a script.
`ScriptElement(java.lang.String script)` Deprecated. Constructs a ScriptElement with the specified String.

Method Summary
`protected java.lang.String` | `getHtmlCode()` Deprecated.
`protected boolean` | `printCR()` Deprecated.
`ScriptElement` | `setLanguage(java.lang.String val)` Deprecated. Use ElementWithAttributes.setLang()
`ScriptElement` | `setScript(java.lang.String script)` Deprecated. Sets the script for a ScriptElement to the specified string.
`ScriptElement` | `setSrc(java.lang.String val)` Deprecated. Sets the SRC attribute for a ScriptElement.

Methods inherited from class weblogic.html.SinglePartElement
`getElement, printBody, printBody, printBody, setElement, setElement, widthAsLiteral`

Methods inherited from class weblogic.html.ElementWithAttributes
`addAttribute, addAttribute, escapeQuotes, getBooleanAttribute, getElementAttribute, getLocalVar, getQuotedAttribute, output, output, output, printBody, printEndingTag, setBooleanAttribute, setBooleanAttribute, setClass, setDirection, setElementAttribute, setElementAttribute, setElementAttribute, setElementAttribute, setElementAttribute, setId, setLang, setLocalVar, setQuotedAttribute, setStyle`

Methods inherited from class weblogic.html.HtmlElement
`asAnchorElement, asBigElement, asBlockquoteElement, asBoldElement, asCenteredElement, asCiteElement, asCodeElement, asCommentElement, asDefineTermElement, asEmphasisElement, asFontElement, asFontElement, asFontElement, asHtmlContainer, asItalicElement, asKeyboardElement, asLiteralElement, asParagraphElement, asSampleElement, asSmallElement, asStrikeElement, asStrongElement, asSubscriptElement, asSuperscriptElement, asTeletypeElement, asUnderlineElement, asVariableElement, getVersion, setAnchorMode, setCodeset, toString, toString`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### ScriptElement

    public ScriptElement()

  Deprecated.
  Constructs a ScriptElement without a script. Call the setSrc() method to refer to a file that contains the script, or call the setScript() method to set the script. Using this constructor without setting a source or a script will result in a scripting error for some scripting languages.

### ScriptElement

    public ScriptElement(java.lang.String script)

  Deprecated.
  Constructs a ScriptElement with the specified String.

  Parameters:
    `script` - Script

Method Detail

### setLanguage

    public ScriptElement setLanguage(java.lang.String val)

  Deprecated. Use ElementWithAttributes.setLang()
  Deprecated in 2.6. Use ElementWithAttributes.setLang().

### setScript

    public ScriptElement setScript(java.lang.String script)

  Deprecated.
  Sets the script for a ScriptElement to the specified string.

### setSrc

    public ScriptElement setSrc(java.lang.String val)

  Deprecated.
  Sets the SRC attribute for a ScriptElement. In most cases the value of the SCR attribute specifies the language with the file extension, for example "myFile.js" for a JavaScript source. The file extension must be mapped by the web server to a specific MIME type, which the server sends back in the HTTP GET reply's Content-type header. If the server is not configured to map the file extension to a MIME type, the browser may not respond properly with the data that is returned in the HTTP response to a source-initiated request.

  Also use this method to set the source of a ScriptElement to a URL. Call the superclass `setType()` method with a MIME type from the MimeType class.

  Parameters:
    `val` - Source
  Returns:
    ScriptElement object
  See Also:
    `MimeType`

### getHtmlCode

    protected java.lang.String getHtmlCode()

  Deprecated.

  Overrides:
    getHtmlCode in class ElementWithAttributes

### printCR

    protected boolean printCR()

  Deprecated.

  Overrides:
    printCR in class ElementWithAttributes

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Documentation is available at http://e-docs.bea.com/wls/docs60
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD