Cookies improve the way our website works, by using this website you are agreeing to our use of cookies. For more information see our privacy policy.
OK
Returns an element or a collection of elements from the current collection by name or index.
Parameters:
nameOrIndex
Required. A string or a zero-based integer that specifies the element or elements to retrieve.
If an integer value is specified, it specifies the index of the element to retrieve.
If this parameter is a string, then it specifies a value for the name or id property of the element or elements to retrieve.
Return value:
If no match is found, it returns undefined.
If exactly one match is found, it returns the matching applet element.
If more than one match is found, it returns an applets sub-collection filled with the matching elements.
The sub-collection contains the matching elements in source order.
In Firefox, if more than one match is found, the first matching element is returned.
Returns an element or a collection of elements from the current collection by name or index.
Parameters:
nameOrIndex
Required. A string or a zero-based integer that specifies the element or elements to retrieve.
If an integer value is specified, it specifies the index of the element to retrieve.
If this parameter is a string, then it specifies a value for the name or id property of the element or elements to retrieve.
Firefox does not support string values.
subIndex
Optional. Supported by Internet Explorer only.
If more than one matching element is found for the index parameter (possible only if it is a string), the item method creates an applets sub-collection filled with the matching elements.
In that case, the subIndex property specifies the position of the element in the sub-collection to retrieve.
In other cases, the subIndex property has no meaning.
Return value:
If no match is found, it returns null in Internet Explorer, Firefox and Opera, and returns undefined in Google Chrome and Safari.
If exactly one match is found, it returns the matching applet element.
If more than one match is found, it returns an applets sub-collection filled with the matching elements.
The sub-collection contains the matching elements in source order.
Returns an element or a collection of elements from the current collection by name.
Parameters:
name
Required. String that specifies a value for the name or id property of the element or elements to retrieve.
Return value:
If no match is found, it returns null in Internet Explorer, Firefox and Opera, and returns undefined in Google Chrome and Safari.
If exactly one match is found, it returns the matching applet element.
If more than one match is found, it returns an applets sub-collection filled with the matching elements.
The sub-collection contains the matching elements in source order.
In Firefox, if more than one match is found, the first matching element is returned.
Returns a NodeList collection that contains all elements to which the specified behavior is attached.
Example HTML code 1:
This example illustrates the use of the applets collection:
Code
HelloWorld.java
<head><scripttype="text/javascript">function GetCode () {
var applet = document.applets[0];
alert (applet.code);
}
</script></head><body><appletcode="HelloWorld.class"codebase="/external/examples/common/java/"style="width:200px; height:50px;"></applet><br/><br/><buttononclick="GetCode ();">Get the Java class file that contains the Java applet!</button></body>
import java.awt.Graphics;
import java.awt.Font;
import java.awt.Color;
publicclass HelloWorld extends java.applet.Applet {
publicvoid init() {
}
publicvoid paint(Graphics g) {
Font font = new Font ("Arial", Font.BOLD, 22);
g.setFont (font);
g.setColor (Color.blue);
g.drawString("Hello world!", 40, 30);
}
}