salve ragazzi io ho un piccolo problema con un js
ovvero tramite i tasti indietro e avanti posso scorrere le img, in più ho un campo select da dove posso scegliere la pagina da visualizzare.
Ora quando uso i tasti avanti e indietro funziona, ma quando uso il select non va.
In più riesco a far visualizzare il numero totale di immagini ma non riesco a stampare a che immagine mi trovo (es. 1 di 4)
Vi posto il codice nella speranza che possiate aiutarmi
codice:
<script language="javascript" type="text/javascript">
<!--
var isIE=document.all?true:false;
var isDOM=document.getElementById?true:false;
current = 0;
PicVar = 0;
PicVal = new Array();
TxtVal = new Array();
PicVal[PicVar] = "<?=$_url?>scan/23/1554/Hello-Baby-[Oneshot]-(00).jpg";
TxtVal[PicVar++] = "Questa è la luna vista dalla mia navicella spaziale!";
PicVal[PicVar] = "<?=$_url?>scan/23/1554/Hello-Baby-[Oneshot]-(01).jpg";
TxtVal[PicVar++] = "Altra foto della luna";
function Show_foto(newpic) {
if(isDOM)document.getElementById("_foto").src = PicVal[newpic];
else if(isIE) document._foto.src = PicVal[newpic];
//document.form_foto.testo_foto.value=TxtVal[newpic];
//document.form_foto.data_foto.value=DatVal[newpic];
SelectionBox = document.form_foto.menudrop;
SelectionBox.options[newpic].selected = true;
current = newpic;
}
function Random_foto() {
TotalImages = document.form_foto.menudrop.options.length;
current = Math.floor(Math.random()*TotalImages);
Show_foto(current);
}
function Previous_foto() {
TotalImages = document.form_foto.menudrop.options.length;
current--;
if(current<0) current = TotalImages - 1;
Show_foto(current);
}
function Next_foto() {
TotalImages = document.form_foto.menudrop.options.length;
current++;
if (current>=TotalImages) current = 0;
Show_foto(current);
}
// -->
</script>
HTML
codice:
<SCRIPT Language="Javascript">document.write("<font face='verdana'>Stai visualizando la pagina "+image_corrent+" di " + (PicVar-1) + "</font>");</script>
<table border=0 width=100% cellpadding=0 cellspacing=0>
<FORM NAME="form_foto">
<tr align=center>
<td height=30>
<input type=button value=".: Precedente :." onClick="Previous_foto();" class="bottoni">
<input type=button value=".: Prossima :." onClick="Next_foto();" class="bottoni">
</td></tr>
<tr align=center><td height=30>
<script language=javascript>
<!--
TotalImages = PicVar;
document.write("<SELECT class='tendina' name='menudrop' onChange='Show_foto(form_foto.menudrop.options.sel ectedIndex);'>");
for (loop=0; loop < TotalImages; loop++)
{
document.write("<option value=" + PicVal[loop] + ">Page n." + ([loop+1]) + "</option>");
}
-->
</script>
</td></tr>
<tr align=center>
<td>
[img]<?=$_url?>scan/23/1554/Hello-Baby-[Oneshot]-(00).jpg[/img]
</td>
</tr>
</tr>
</FORM>
</table>
Grazie mille dell'aiuto