Ver Mensaje Individual
  #1 (permalink)  
Antiguo 10/07/2007, 09:07
Pollito_69
 
Fecha de Ingreso: julio-2007
Mensajes: 62
Antigüedad: 16 años, 10 meses
Puntos: 0
Problema con una presentación de imágenes

Bueno, antes de nada pongo el código que necesito arreglar:
Código:
<html>
<head>
<script language="JavaScript" type="text/javascript">
var cSlideShowTimeout = 4000;
var iSlideCurrent = -1;
var timeoutid = "";

function GetFileName(strFileName)
{
	var rgData = strFileName.split("/");
	if (rgData.length > 0)
		return rgData[rgData.length-1];
	else
		return "";
}

function StopSlideShow()
{
	var SlideShowPlay = document.getElementById("SlideShowPlay");
	parent.window.fSlideShow = false;
	SlideShowPlay.src = "../../Site/images/WGW_SlidePlay.gif";
	iSlideCurrent = -1;
}

function runSlides()
{
	var SlideShowPlay = document.getElementById("SlideShowPlay");
	
	if (parent.window.fSlideShow == true)
	{
		SlideShowPlay.src = "../../Site/images/WGW_SlideStop.gif";
		timeoutid = setTimeout("Ticker()", cSlideShowTimeout);
	}
	else
	{
		SlideShowPlay.src = "../../Site/images/WGW_SlidePlay.gif";
		if (timeoutid != "")
			clearTimeout(timeoutid);
	}
}

function SlideShow()
{
	var SlideShowPlay = document.getElementById("SlideShowPlay");
	
	// toggle the existing state
	parent.window.fSlideShow = !parent.window.fSlideShow;
	
	// start or stop the slide show
	if (parent.window.fSlideShow == true)
	{
		SlideShowPlay.src = "../../Site/images/WGW_SlideStop.gif";
		NavigateSlideShow();
		timeoutid = setTimeout("Ticker()", cSlideShowTimeout);
	}
	else
	{
		SlideShowPlay.src = "../../Site/images/WGW_SlidePlay.gif";
		if (timeoutid != "")
			clearTimeout(timeoutid);
	}
}

function Ticker()
{
  if (g_fIEBrowser)
   {
	   if (document.readyState == "complete")
   	   {
		// navigate to the next image in album and set another timer
		NavigateSlideShow();
   	   }
   }
   else
   {
	NavigateSlideShow();
   }
   timeoutid = setTimeout("Ticker()", cSlideShowTimeout);
}

function NavigateSlideShow()
{
	if (parent.window.fSlideShow == false)
	{
	StopSlideShow();
	return;
	}
	var strSource = GetFileName(document.getElementById("MainImage").src);
	var oMainDoc = window.parent.document;
	if (iSlideCurrent == -1)
	{
		for (i = 0; i<oMainDoc.images.length; i++)
		{
			if (strSource == GetFileName(oMainDoc.images.item(i).src))
			{
			iSlideCurrent = i;
			break;
			}
		}
	}
	
	resetImageOnObject(oMainDoc.images.item(iSlideCurrent));
	iSlideCurrent = (iSlideCurrent +1) % (oMainDoc.images.length-1);
	if (!g_fIEBrowser)
	{
		if (iSlideCurrent == 0)
			iSlideCurrent = 1;
	}

	oMainDoc.images.item(iSlideCurrent).parentNode.focus();

	if (g_fIEBrowser)
	{
		oMainDoc.images.item(iSlideCurrent).click();
	}
	else
	{
		window.open(oMainDoc.images.item(iSlideCurrent).parentNode.href,"_self");
	}

	parent.window.fSlideShow = true;
}

function CheckSlideShow()
{
	runSlides();		
}	

function SlideShowMouseOver()
{
	var SlideShowPlay = document.getElementById("SlideShowPlay");
	if (parent.window.fSlideShow == true)
	{
		SlideShowPlay.src = "../../Site/images/WGW_SlideStop_f2.gif";
		SlideShowPlay.style.cursor='hand';
	}
	else
	{
		SlideShowPlay.src = "../../Site/images/WGW_SlidePlay_f2.gif";
		SlideShowPlay.style.cursor='hand';
	}
}

function SlideShowMouseOut()
{
	var SlideShowPlay = document.getElementById("SlideShowPlay");
	if (parent.window.fSlideShow == true)
	{
		SlideShowPlay.src = "../../Site/images/WGW_SlideStop.gif";
		SlideShowPlay.style.cursor='default';
	}
	else
	{
		SlideShowPlay.src = "../../Site/images/WGW_SlidePlay.gif";
		SlideShowPlay.style.cursor='default';
	}
}
</script>
</head>
<body>
<img src="../../Site/images/WGW_SlidePlay.gif" alt="" name="SlideShowPlay" width="62" height="19" border="0" id="SlideShowPlay" onclick="SlideShow()" onmouseout="SlideShowMouseOut()" onmouseover="SlideShowMouseOver()" />
</body>
</html>
Bueno pues resulta, que este código lo que hace es, dentro de un div, y al hacer clic en una imágen (presentación) que ejecuta la función SlideShow, cambiar de página html para que vayan pasando unas imágenes, pero el caso es que al llegar a la última página html (es decir, a la última imágen) aparecen los errores, ya que en internet explorer continúa la presentación hasta la primera página, y en mozilla también continúa pero hace como que pasa a la misma imágen. ¿hay alguna manera de que con este código al llegar a la última página se pare automáticamente la presentación?
Y por último, si no es mucho pedir, creo que tendría que añadir una nueva función, que al hacer clic en una imágen me llevara automáticamente a la última página (que contiene la última imagen), y al hacer clic en otra imágen, me llevara a la primera página (que contiene la primera imágen).
Un saludo y gracias por vuestra atención.
Pd. si necesitáis ver un ejemplo lo tenéis en:
http://pollito69.110mb.com/prueba/Album1.htm

Última edición por Pollito_69; 10/07/2007 a las 15:44