100% found this document useful (1 vote)
373 views

Javafunction AppletLoad

This document contains JavaScript code to load and test an applet. It first checks the browser and determines if it is Internet Explorer. It then inserts the applet code into the HTML, either as an OBJECT tag or EMBED tag depending on the browser. It sets a loadflag variable to track if the applet loaded successfully. After loading, it gets the applet version and checks if it meets the minimum requirements, displaying the results in green or red text based on the check.

Uploaded by

nitintsh
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
373 views

Javafunction AppletLoad

This document contains JavaScript code to load and test an applet. It first checks the browser and determines if it is Internet Explorer. It then inserts the applet code into the HTML, either as an OBJECT tag or EMBED tag depending on the browser. It sets a loadflag variable to track if the applet loaded successfully. After loading, it gets the applet version and checks if it meets the minimum requirements, displaying the results in green or red text based on the check.

Uploaded by

nitintsh
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

function AppletLoad(){

var jar1="AppletTest.jar" ;
var aplt = document.getElementById("appletDiv");
var MSIE1 = false;
var browser1 = navigator.userAgent.toLowerCase();
if ((browser1.indexOf('msie') >= 0) &&
(browser1.indexOf('opera') < 0)) MSIE1 = true;
try{
if(MSIE1)
aplt.innerHTML = '<OBJECT classid="clsid:8AD9C840-
044E-11D1-B3E9-00805F499D93" id = "apltid" name = "aplttest" width="1"
height="1">'+
'<param name="code"
value="AppletLoadTest.class"> '+
'<param name="archive"
value="/ireps/pki/' + jar1 + '" /></OBJECT>';
else
aplt.innerHTML ='<embed id="apltid" type="application/x-
java-applet;" width="1" height="1" archive="/ireps/pki/' + jar1 + '"
code="AppletLoadTest.class"/>'+
'</embed>';
this.loadflag = true;
}
catch (e) {
this.loadflag = false;
}
}

function ApltLoadTest(){
if(this.loadflag)
{
try{
var apltId= document.getElementById("apltid")
var jrever = apltId.vercheck();
var no1 = parseFloat(jrever.substring(0,3));
var no2 = parseFloat(jrever.substring(6,8));
var flag = false;
if(no1>1.6)flag = true;
else if(no1==1.6)
{
if(no2>=45)flag=true;
else alert("Installed JRE Version is not
latest.");
}
else flag = false;
if( flag == true)
{
document.getElementById('verlabel').innerHTML =
'Successful (Installed JRE ver is '+jrever+'.)';
document.getElementById('verlabel').style.color =
'green';
}
else
{
document.getElementById('verlabel').innerHTML = 'Failed
(Installed JRE ver is '+jrever+'.)';
document.getElementById('verlabel').style.color = 'red';
}
}
catch (err) {
alert("Failed to open AppletLoader:"+err.message);
document.getElementById('verlabel').innerHTML = 'Failed';
document.getElementById('verlabel').style.color = 'red';
}
}
else{
alert("Failed to load Applet");
document.getElementById('verlabel').innerHTML = 'Failed';
document.getElementById('verlabel').style.color = 'red';

}
}

You might also like