JavaScript Tutorial/Document/applets

Материал из Web эксперт
Перейти к: навигация, поиск

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