I created a small applet for my sister's blog that flashes colors randomly. She wants to set it as her background for her webpage. I've already figured out how to find the size of a web page and all that, but how do I declare the applet's width and height to be values of my functions?
Here's the tester page code:
<html>
<head>
<title>Flashing colors</title>
<script type="text/javascript">
var w = window,
d = document,
e = d.documentElement,
g = d.getElementsByTagName('body')[0],
x = w.innerWidth || e.clientWidth || g.clientWidth,
y = w.innerHeight|| e.clientHeight|| g.clientHeight;
function getWidth(){
return x;
}
function getHeight(){
return y;
}
</script>
</head>
<body>
//Here's the problem
<applet code="FlashingColors.class" width=getWidth() height=getHeight()>
</applet>
</body>
</html>
I have no experience in html or javascript, but plenty in Java. If someone could explain what to do and why it works, that would be nice.
Update: At this point, I do realize that one wouldn't use an applet, but at this point I just want to figure out how to make it work, because I am curious and want to learn.