Ver Mensaje Individual
  #1 (permalink)  
Antiguo 15/04/2003, 09:15
rashid
 
Fecha de Ingreso: enero-2002
Ubicación: Perez Zeledon Costa Rica
Mensajes: 1.009
Antigüedad: 22 años, 4 meses
Puntos: 11
abrir ventana con autoajuste imagen

Soy nuevo aqui, no conozco gran cosa de Js, por eso aprecio toda su ayuda amigos.

Lo que quiero es que abrir una ventanita que se autoajuste al tamaño de la imágen, por eso he usado un script de las faqs de Tunait, muy bueno. Pero al tratar de integrarlo con php parece que he roto el script y aunque el link se muestra, al dar click no se abre la ventanita, sino que me abre la imágen en la misma ventana.

arriba del head

<SCRIPT LANGUAGE="JavaScript">
<!--
function showB(url){
var ur = "http://";
var myurl = ur + new String(url);
the_window = window.open(myurl,'foto','toolbar=no,location=yes, directories=no,status=yes,menubar=yes,scrollbars=y es,resizable=yes,copyhistory=no,dependent=no,scree nX=0,screenY=0,width=500,height=500');
}
-->
//script por Tunait
var ventana
var cont=0
var titulopordefecto = "Perico de los palotes" //texto por defecto a mostrar en la barra de título en caso de omitir el argumento titulo

function afoto(cual,titulo)
{
if(cont==1){ventana.close();ventana=null}
if(titulo==null){titulo=titulopordefecto}
ventana=window.open('','ventana','resizable=yes,sc rollbars=no')
ventana.document.write('<html><head><title>' + titulo + '</title></head><body style="overflow:hidden" marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" scroll="no" onUnload="opener.cont=0"><img src="' + cual + '" onLoad="opener.redimensionar(this.width, this.height)">')
ventana.document.close()
cont++
}
function redimensionar(ancho,alto)
{
ventana.resizeTo(ancho+12,alto+28)
ventana.moveTo((screen.width-ancho)/2,(screen.height-alto)/2) //centra la ventana. Eliminar si no se quiere centrar el popup
}
</script>
<head>
</head>

la imagen:

$dbfile2="php/images/clients/".$rowF["image2"];
if ($rowF["image2"] !== ''){
if (file_exists($dbfile2)){
echo "<a href='".$dbfile2."' onClick='afoto('".$dbfile2."','Mi titulo');return false'> <img src='".$dbfile2."' width='140' height='80'></a><br>";



Ayuda

Gracias.