JavaScript Tutorial/Document/applets
Версия от 18:52, 25 мая 2010; (обсуждение)
Checking for Java Applets with the length Property of the Applet Array
<HTML>
<HEAD>
<TITLE>Checking for Java Applets</TITLE>
<SCRIPT LANGUAGE="JavaScript">
<!--
function checkApplets(){
var numApplets = document.applets.length;
if(numApplets == 0){
alert(0);
} else if (numApplets == 1){
alert(1);
} else if (numApplets > 2){
alert(2);
}
}
-->
</SCRIPT>
</HEAD>
<BODY onLoad="checkApplets()">
<CENTER>
<TABLE BORDER=1>
<TR>
<TD>
<APPLET CODE="TestApplet" CODEBASE="." WIDTH=200 HEIGHT=35 NAME="AppletOne" MAYSCRIPT>
This browser is not able to run Java applets
<PARAM NAME="clickurl" VALUE="http://www.wbex.ru">
</APPLET>
</TD>
</TR>
<TR>
<TD>
<APPLET CODE="TestApplet" CODEBASE="." WIDTH=200 HEIGHT=35 NAME="AppletTwo">
This browser is not able to run Java applets
<PARAM NAME="clickurl" VALUE="http://www.wbex.ru">
</APPLET>
</TD>
</TR>
</TABLE>
</CENTER>
</BODY>
</HTML>
document.applets
Syntax
document.applets
document.applets[index]
document.applets.length
Syntax
document.applets.length