|
BEA Systems, Inc. | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object
|
+--weblogic.html.HtmlElement
|
+--weblogic.html.ElementWithAttributes
|
+--weblogic.html.SinglePartElement
|
+--weblogic.html.ScriptElement
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.
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 java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
| Constructor Detail |
public ScriptElement()
public ScriptElement(java.lang.String script)
script - Script| Method Detail |
public ScriptElement setLanguage(java.lang.String val)
public ScriptElement setScript(java.lang.String script)
public ScriptElement setSrc(java.lang.String val)
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.
val - SourceMimeTypeprotected java.lang.String getHtmlCode()
protected boolean printCR()
|
Documentation is available at http://download.oracle.com/docs/cd/E13222_01/wls/docs60 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||