ASP y JavaScript

11/01/2004 - 13:51 por RgSystems | Informe spam
Hola a todos tengo un problemilla:

Casi mejor pego el código fuente para que veais cual es el problema y lo que
quiero hacer.
¿cual es la mejor forma?

Un saludo
__________________________________________________
<% cam=rs("Camino") %>
<img src= <%=rs("Camino")%> border="0" align="absmiddle"
noresize
onclick= "
<script language=javascript>
var win=null;
url_imagen=win.document.foto
var img = new Image();
img.src = <%=cam%>;

win=window.open('','','width='+img.width+',height='+img.height+',scrollbarsno,resizable=1,toolbar=0');
win.document.write ('<html>');
win.document.write (' <head>');
win.document.write (' <title> '+'</title>');
win.document.write (' </head>');
win.document.write (' <body leftmargin="0" topmargin="0"
marginwidth="0" marginheight="0">');
win.document.write (' <img src="' + url_imagen + '"
height='+img.height+' width='+img.width+'>');
win.document.write (' </body>');
win.document.write ('</html>');
</script>
">

__________________________________________________

Supongo que las comillas dobles despues de ONCLICK no pueden funcionar, pero
es para mostrar lo que quiero hacer.

Robert

Preguntas similare

Leer las respuestas

#1 danicastillo
11/01/2004 - 14:00 | Informe spam
ufs pos no ha quedado muy claro sobretodo pq has metido lo de script
dentro del onclick ;)

prueba :

1 encapsula todo el codigo en una funcion que reciba uno o dos parametros
(la imagen supongo), eso "fuera" de la sentencia IMG

2 en el onClick llamas a esa funcion

te simplificara mucho el tema de comillas dobles--

-o|o|--
-o|o| dani castillo
-o|o| http://www15.brinkster.com/danic/
-o|o| tutorial y trucos asp, vb, diseño
-o|o|--
"RgSystems" escribió en el mensaje
news:%
Mostrar la cita
que
Mostrar la cita
win=window.open('','','width='+img.width+',height='+img.height+',scrollbars> no,resizable=1,toolbar=0');
Mostrar la cita
pero
Mostrar la cita
#2 RgSystems
11/01/2004 - 16:36 | Informe spam
Gracias Dani,

Lo he intentado, pero como al principio de la pág. tengo :
<%@ languaje=vbscript%>
no sé donde colocar la función de javascript . Tanto al principio como al
final de la pag me da error.
No sé, será lo de ser novato.

Gracías de todas formas.

Un saludo
Robert




"danicastillo" escribió en el
mensaje news:
Mostrar la cita
parametros
Mostrar la cita
win=window.open('','','width='+img.width+',height='+img.height+',scrollbars> > no,resizable=1,toolbar=0');
Mostrar la cita
#3 marco chaires
12/01/2004 - 21:13 | Informe spam
Tu codigo seria mejor asi...



SAludos..





<% cam=rs("Camino") %>

<img src= <%=rs("Camino")%> border="0" align="absmiddle" noresize onclick"miFuncionJava('<%=cam%>');">



<script language=javascript>

function miFuncionJava(parametro)

{

var win=null;

url_imagen=win.document.foto

var img = new Image();

img.src = parametro;




win=window.open('','','width='+img.width+',height='+img.height+',scrollbarsno,resizable=1,toolbar=0');

win.document.write ('<html>');

win.document.write (' <head>');

win.document.write (' <title> '+'</title>');

win.document.write (' </head>');

win.document.write (' <body leftmargin="0" topmargin="0"
marginwidth="0" marginheight="0">');

win.document.write (' <img src="' + url_imagen +
'"height='+img.height+' width='+img.width+'>');

win.document.write (' </body>');

win.document.write ('</html>');

}

</script>



MARCO CHAIRES





"RgSystems" wrote in message
news:%
Mostrar la cita
que
Mostrar la cita
win=window.open('','','width='+img.width+',height='+img.height+',scrollbars> no,resizable=1,toolbar=0');
Mostrar la cita
pero
Mostrar la cita
#4 RgSystems
13/01/2004 - 09:08 | Informe spam
Gracias Marco,

Funciona perfectamente.

Ahora, y ya por curiosidad, donde puedo meter las funciones de java?, en el
cuerpo?, en cualquier sitio?.

De todas formas, gracias de nuevo, me solucionaste el tema.

Un saludo

Robert

"marco chaires" escribió en el mensaje
news:Ou$
Mostrar la cita
onclick> "miFuncionJava('<%=cam%>');">
Mostrar la cita
win=window.open('','','width='+img.width+',height='+img.height+',scrollbars> no,resizable=1,toolbar=0');
Mostrar la cita
win=window.open('','','width='+img.width+',height='+img.height+',scrollbars> > no,resizable=1,toolbar=0');
Mostrar la cita
Ads by Google
Search Busqueda sugerida