document.write()

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
aaaphp000000
Forum Newbie
Posts: 22
Joined: Mon Aug 29, 2005 5:39 am

document.write()

Post 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?
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post 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();
;)
User avatar
n00b Saibot
DevNet Resident
Posts: 1452
Joined: Fri Dec 24, 2004 2:59 am
Location: Lucknow, UP, India
Contact:

Post 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.
foobar
Forum Regular
Posts: 613
Joined: Wed Sep 28, 2005 10:08 am

Post by foobar »

You can also use:

Code: Select all

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