I run it in ms internet explorer 5.5 and it worked ok,
it return an InetAddress object.
And if I call an getHostName() method:
alert(a.getHostName());
it return my pc´s name.
If it returns null , maybe the applet havn´t been
initialited yet.
Try put it in a body tag and in the function
window.onload() call to foo()
Check the jvm in your browser too.
This works for me:
-------------------------------------------
<html>
<body>
<applet code="ComputerName.class" width="100"
height="100"></applet>
</body>
</html>
<script language="JavaScript">
function window.onload(){
foo();
}
function foo() {
with(document.applets[0]) {
var a = getVariable();
alert(a.getHostName());
}
}
</script>
-------------------------------------------