Page 1 of 1

document.write()

Posted: Mon Oct 17, 2005 5:01 pm
by aaaphp000000
html code
======================
<script language="JavaScript">
var iW=screen.width;
if(iW>1200) iW-=350;
else
if(iW>=800) iW-=250;
else iW-=50;

var iH=iW*19/26;
var strLet="<APPLET codeBase=./classes width=";
strLet+=iW;
strLet+=" height=";
strLet+=iH;
strLet+=" code=ClassViewer.class></APPLET>";
document.write(strLet);
</script>
=======================

one problem is that if browser (IE) is not maximumed, the java applet can not be displayed well.

how to solve the problem? is there a html object function - such as onDocumentSize() or similar?

Posted: Mon Oct 17, 2005 5:26 pm
by Chris Corbyn
There are some window methods for resizing and moving position..

If I remember correctly

Code: Select all

window.resizeTo(x, y);
window.moveTo(x, y);
But don't take my word for it, it's a while since I have the need to play around with a window itself.

You can also read the screen size, available size etc with...

Code: Select all

var scrWidth = screen.availWidth();
var scrHeight = screen.availHeight();
;)

Posted: Tue Oct 18, 2005 1:44 am
by n00b Saibot
your memory serves you correctly d11wtq ;)

aaaphp, first get the screen width/height and then move and resize the window to the full. then your applet will display jus' fine.

Posted: Wed Oct 19, 2005 11:05 am
by foobar
You can also use:

Code: Select all

window.resizeBy(x, y);
window.moveBy(x, y);
...if you want to resize/move relatively.