Como seto o tamanho do applet para o navegador

5 respostas
S

aes pessoal,
como faço para setar o WIDTH e HEIGHT de um applet para que fique certinho no tamanho do navegador…
assim sendo o applet ficará do tamanho visivel para a resolucao do usuario e se a tela nao estiver maximizada ele tambem ficara no tamanho certo …
vlw

5 Respostas

_fs

Para funcionar no IE

<html>
<head>
<script>
function acertaApplet()
{
    var w = document.documentElement.clientWidth;
    var h = document.documentElement.clientHeight;

    meuApplet.style.width = w;
    meuApplet.style.height = h;
}

</head>
<body onLoad="acertaApplet()">
<applet id="meuApplet" code="meuApplet.class" style="width: 10px; height: 10px;">
</applet>

</body>
</html>

Para funcionar no NS é só trocar o
document.documentElement.clientHeight
document.documentElement.clientWidth
por
window.scrollY + window.innerHeight
window.scrollX + window.innerWidth

ps.: não testei hehe

S

aes LIPE, tp…
não funcionou… ele ta deixando o applet de tamanho 10px como vocÊ setou no applet style…
vlw

V

tenta concatenar “px” no final… assim:

meuApplet.style.width = w + "px";
_fs

Vegetto ta certo :smiley:

S

tah ai como fiz…
vlw ai pela ajuda LIPE…

<HTML>

<HEAD>

<SCRIPT>

function acertaApplet()

{

Viewer.style.width  = document.body[‘clientWidth’]-30;

Viewer.style.height = document.body[‘clientHeight’]-30;

}

</SCRIPT>

</HEAD>

<BODY onLoad=“acertaApplet()”>

<APPLET id=“Viewer” code=“Viewer.class”  style=“width: 10px; height: 10px;”>

</APPLET>

</BODY>

</HTML>
Criado 26 de maio de 2004
Ultima resposta 28 de mai. de 2004
Respostas 5
Participantes 3