Foros del Web » Programando para Internet » Javascript »

Problemas con iframes

Estas en el tema de Problemas con iframes en el foro de Javascript en Foros del Web. Hola, es mi primer tema, soy novato en esto pero intentare explicarme lo mejor que pueda. Tengo una web, en la que estoy poniendo vídeos, ...
  #1 (permalink)  
Antiguo 09/12/2009, 21:09
 
Fecha de Ingreso: diciembre-2009
Mensajes: 6
Antigüedad: 14 años, 4 meses
Puntos: 0
Información Problemas con iframes

Hola, es mi primer tema, soy novato en esto pero intentare explicarme lo mejor que pueda.

Tengo una web, en la que estoy poniendo vídeos, y quisiera que al darle a un botón que pusiera "ver vídeo" se abriera o un pop-up o un iframe en el centro de la web, y que se viera el vídeo que yo tendría ubicado en otra web.
También me gustaría que tuviera un botón de cerrar y así poderle dar a otro vídeo y repetirse la operación, como puedo hacerlo? por favor ayuda, gracias por adelantado a todos aquellos !
  #2 (permalink)  
Antiguo 09/12/2009, 21:32
Avatar de jackson666  
Fecha de Ingreso: noviembre-2009
Ubicación: Buenos Aires, Argentina
Mensajes: 1.971
Antigüedad: 14 años, 5 meses
Puntos: 65
Respuesta: Problemas con iframes

podrias hacer aparecer un div en el que le vas a modificar el contenido, insertandole justamente un video =P

Código HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
	<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
	<meta name="author" content="Jackson666" />

	<title>Video!</title>
<style type="text/css">
#video{
display: none;
position: absolute;
width: 50%;
height: 50%;
top: 25%;
left: 25%;
border: 5px double orange;
background-color: #cccccc;
text-align: center;
}
</style>
    
</head>

<body>
<script language='javascript'>
function asignaVideo(cual,width,height){

var div=document.getElementById("video");

div.innerHTML="";

var object=document.createElement("object");
object.setAttribute("align","center");

var param=document.createElement("param");
param.setAttribute("name","movie");
param.setAttribute("value",cual);

var param2=document.createElement("param");
param.setAttribute("name","play");
param.setAttribute("value","false");

var param3=document.createElement("param");
param.setAttribute("name","loop");
param.setAttribute("value","false");

var param4=document.createElement("param");
param.setAttribute("name","allowFullScreen");
param.setAttribute("value","true");

object.appendChild(param);
object.appendChild(param2);
object.appendChild(param3);
object.appendChild(param4);


var newTag=document.createElement("embed");
newTag.setAttribute("src",cual);
newTag.setAttribute("type","application/x-shockwave-flash");
newTag.setAttribute("width",width);
newTag.setAttribute("height",height);
newTag.setAttribute("autostart","false");
newTag.setAttribute("loop","false");
newTag.setAttribute("align","center");

object.appendChild(newTag);

var a = document.createElement("a");
a.setAttribute("href","javascript:cierra()");
var txt=document.createTextNode("Cerrar");
a.appendChild(txt);

var p=document.createElement("p");
p.setAttribute("align","center");
p.appendChild(a);

div.appendChild(p);
div.appendChild(object);
div.style.display='block';


}

function cierra(){

var div=document.getElementById("video");
var obj=document.getElementById("video").getElementsByTagName("object")[0];
var padre=obj.parentNode;

padre.removeChild(obj);

div.style.display='none';

}
</script>

<div id="video"></div>

<a href="javascript:asignaVideo('urlDelVideo1','auto','auto')">Video 1</a>
<a href="javascript:asignaVideo('urlDelVideo2','width','height')">Video 2</a>
<a href="javascript:asignaVideo('urlDelVideo3','width','height')">Video 3</a>

</body>
</html> 
Tene consideracion, mira la hora que es... Gracias si esto te muestra un par de links =P

PD: fui bueno porq recien empezas, pero podrias haber buscado en google, un poquito mejor
PD2: venga todo el karma que tengas jajajaj

Última edición por jackson666; 09/12/2009 a las 22:13
  #3 (permalink)  
Antiguo 10/12/2009, 10:21
 
Fecha de Ingreso: diciembre-2009
Mensajes: 6
Antigüedad: 14 años, 4 meses
Puntos: 0
Respuesta: Problemas con iframes

Muchas gracias, el código me funciona correctamente, gracias!
  #4 (permalink)  
Antiguo 10/12/2009, 10:57
Avatar de jackson666  
Fecha de Ingreso: noviembre-2009
Ubicación: Buenos Aires, Argentina
Mensajes: 1.971
Antigüedad: 14 años, 5 meses
Puntos: 65
Respuesta: Problemas con iframes

Cita:
Iniciado por aldiezal Ver Mensaje
Muchas gracias, el código me funciona correctamente, gracias!
Venga ese karma compañero entonces!
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 11:30.