Domanda su script che indirizza in base a risoluzione

D

Dante

Imposto qui la domanda che avevo erroneamente impostato in un ng Java.
Qualcuno mi saprebbe dire perchè lo script seguente funziona bene per
risoluzione 800x600, indirizzando alla pagina index_800.htm, funziona
bene per le risoluzioni più alte, indirizzando alla pagina index.htm,
ma NON funziona se la risoluzione è 640x480, nel qual caso presenta la
pagina index.htm?
L'ho provato su 3PC, ma il risultato è sempre lo stesso.
Grazie molte in anticipo a tutti coloro che mi risponderanno
-------------------------

<script language="javascript">
<!--
var s_width ='';
var s_height ='';
s_width=screen.width
s_height=screen.height

if (s_width == "640"){
location.href="index_640.htm";
}

if (s_width == "800"){
location.href="index_800.htm";
}

else {
location.href="index.htm";
 
E

Evertjan.

Dante wrote on 07 feb 2004 in comp.lang.javascript:
<script language="javascript">
<!--
var s_width ='';
var s_height ='';
s_width=screen.width
s_height=screen.height

if (s_width == "640"){
location.href="index_640.htm";
}

if (s_width == "800"){
location.href="index_800.htm";
}

else {
location.href="index.htm";

} // !!!


Molto simplificato :

<script type="text/javascript">
var s_width=screen.width;
if (s_width < 641)location.href="index_640.htm";
if (s_width < 801)location.href="index_800.htm";
location.href="index.htm";
</script>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,073
Latest member
DarinCeden

Latest Threads

Top