Foros del Web » Programando para Internet » Javascript »

¿Codigo javascript para conseguir una venta emergente?

Estas en el tema de ¿Codigo javascript para conseguir una venta emergente? en el foro de Javascript en Foros del Web. Hola estoy buscando el codigo javascript para poder conseguir una ventana emergente al igual que cinetube.es Cuando entras a la web de cinetube abajo a ...
  #1 (permalink)  
Antiguo 19/01/2011, 07:54
 
Fecha de Ingreso: enero-2011
Mensajes: 12
Antigüedad: 13 años, 3 meses
Puntos: 1
¿Codigo javascript para conseguir una venta emergente?

Hola estoy buscando el codigo javascript para poder conseguir una ventana emergente al igual que cinetube.es

Cuando entras a la web de cinetube abajo a la izq te sale una pequeña ventana emergente, quisiera algo igual o parecido... MUCHAS GRACIAS

No he podido encontrar nada....

Mi web: showdj.es y lafactoriadj.com
  #2 (permalink)  
Antiguo 19/01/2011, 08:11
Avatar de _cronos2
Colaborador
 
Fecha de Ingreso: junio-2010
Mensajes: 2.062
Antigüedad: 13 años, 10 meses
Puntos: 310
Respuesta: ¿Codigo javascript para conseguir una venta emergente?

¿Probaste con window.open()?
__________________
" Getting older’s not been on my plans
but it’s never late, it’s never late enough for me to stay. "
Cigarettes - Russian Red
  #3 (permalink)  
Antiguo 19/01/2011, 10:27
 
Fecha de Ingreso: enero-2011
Mensajes: 12
Antigüedad: 13 años, 3 meses
Puntos: 1
Respuesta: ¿Codigo javascript para conseguir una venta emergente?

Cita:
Iniciado por _cronos2 Ver Mensaje
¿Probaste con window.open()?
Creo que si, ahora mismo no me acuerdo....

¿Como seria el codigo?
  #4 (permalink)  
Antiguo 19/01/2011, 10:46
Avatar de goteen_mx  
Fecha de Ingreso: abril-2005
Ubicación: D.F.
Mensajes: 403
Antigüedad: 19 años
Puntos: 37
Respuesta: ¿Codigo javascript para conseguir una venta emergente?

http://www.w3schools.com/jsref/met_win_open.asp
  #5 (permalink)  
Antiguo 19/01/2011, 13:15
 
Fecha de Ingreso: diciembre-2009
Ubicación: Valparaíso
Mensajes: 118
Antigüedad: 14 años, 4 meses
Puntos: 3
Respuesta: ¿Codigo javascript para conseguir una venta emergente?

;)
Código Javascript:
Ver original
  1. function abrepopup(pagina,nombre,alto,ancho) {
  2.     window.open(pagina, nombre, "toolbar=no,location=no,directories=no,status=no,scrollbars=NO,menubar=no,resizable=NO,width="+ancho+",height="+alto);
  3. }
  #6 (permalink)  
Antiguo 21/02/2011, 11:53
 
Fecha de Ingreso: enero-2011
Mensajes: 12
Antigüedad: 13 años, 3 meses
Puntos: 1
Respuesta: ¿Codigo javascript para conseguir una venta emergente?

Muchas Gracias A Todos, pero lo que ustedes me proponian, no es lo que buscaba...

Aqui les dejo la respuesta a mi dilema xD

El Siguiente Codigo ha de ir entre las etiquetas <head> - NO TE OLVIDES DE SUSTITUIR LO QUE ESTA ESCRITO EN ESPAÑOL

Demo (Abajo-izq): [URL="http://www.showdj.es"]http://www.showdj.es[/URL] o [URL="http://www.cinetube.es"]http://www.cinetube.es[/URL]

No intento hacer SPAM, pero no he podido encontrar otra web que no sea la mia y la de cinetube, que tenga ese "HTML"

en background-color: none; LES RECOMIENDO NO SUSTIRUIRLO, para mayor "Elegancia"

<style type="text/css">

#topbar{
position:absolute;
border: Nº QUE QUIERESpx solid black;
padding: Nº QUE QUIERES px;
background-color: none;
width: ANCHO DE LA VENTANApx;
visibility: hidden;
z-index: 100;
}

</style>

<script type="text/javascript">

var persistclose=0 //set to 0 or 1. 1 means once the bar is manually closed, it will remain closed for browser session
var startX = 195 //set x offset of bar in pixels
var startY = 262 //set y offset of bar in pixels
var verticalpos="fromtop" //enter "fromtop" or "frombottom"

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function get_cookie(Name) {
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) {
offset += search.length
end = document.cookie.indexOf(";", offset);
if (end == -1) end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(off set, end))
}
}
return returnvalue;
}

function closebar(){
if (persistclose)
document.cookie="remainclosed=1"
document.getElementById("topbar").style.visibility ="hidden"
}

function staticbar(){
barheight=document.getElementById("topbar").offset Height
var ns = (navigator.appName.indexOf("Netscape") != -1) || window.opera;
var d = document;
function ml(id){
var el=d.getElementById(id);
if (!persistclose || persistclose && get_cookie("remainclosed")=="")
el.style.visibility="visible"
if(d.layers)el.style=el;
el.sP=function(x,y){this.style.left=x+"px";this.st yle.top=y+"px";};
el.x = startX;
if (verticalpos=="fromtop")
el.y = startY;
else{
el.y = ns ? pageYOffset + innerHeight : iecompattest().scrollTop + iecompattest().clientHeight;
el.y -= startY;
}
return el;
}
window.stayTopLeft=function(){
if (verticalpos=="fromtop"){
var pY = ns ? pageYOffset : iecompattest().scrollTop;
ftlObj.y += (pY + startY - ftlObj.y)/8;
}
else{
var pY = ns ? pageYOffset + innerHeight - barheight: iecompattest().scrollTop + iecompattest().clientHeight - barheight;
ftlObj.y += (pY - startY - ftlObj.y)/8;
}
ftlObj.sP(ftlObj.x, ftlObj.y);
setTimeout("stayTopLeft()", 10);
}
ftlObj = ml("topbar");
stayTopLeft();
}

if (window.addEventListener)
window.addEventListener("load", staticbar, false)
else if (window.attachEvent)
window.attachEvent("onload", staticbar)
else if (document.getElementById)
window.onload=staticbar
</script>

El siguiente codigo tiene que introducirse entre las etiquetas <body>

<div id="topbar">
<a href="" onClick="closebar(); return false"><img src="IMAGEN CLOSE - CERRAR" border="0" width="25"/></a>

AQUI EL CODIGO HTML, JS, ETC ETC, QUE QUIERAS
</div>

Última edición por wwwshowdjes; 21/02/2011 a las 13:27
  #7 (permalink)  
Antiguo 24/02/2011, 13:17
 
Fecha de Ingreso: enero-2011
Mensajes: 12
Antigüedad: 13 años, 3 meses
Puntos: 1
Respuesta: ¿Codigo javascript para conseguir una venta emergente?

Cita:
Iniciado por wwwshowdjes Ver Mensaje
Muchas Gracias A Todos, pero lo que ustedes me proponian, no es lo que buscaba...

Aqui les dejo la respuesta a mi dilema xD

El Siguiente Codigo ha de ir entre las etiquetas <head> - NO TE OLVIDES DE SUSTITUIR LO QUE ESTA ESCRITO EN ESPAÑOL

Demo (Abajo-izq): [URL="http://www.showdj.es"]http://www.showdj.es[/URL] o [URL="http://www.cinetube.es"]http://www.cinetube.es[/URL]

No intento hacer SPAM, pero no he podido encontrar otra web que no sea la mia y la de cinetube, que tenga ese "HTML"

en background-color: none; LES RECOMIENDO NO SUSTIRUIRLO, para mayor "Elegancia"

<style type="text/css">

#topbar{
position:absolute;
border: Nº QUE QUIERESpx solid black;
padding: Nº QUE QUIERES px;
background-color: none;
width: ANCHO DE LA VENTANApx;
visibility: hidden;
z-index: 100;
}

</style>

<script type="text/javascript">

var persistclose=0 //set to 0 or 1. 1 means once the bar is manually closed, it will remain closed for browser session
var startX = 195 //set x offset of bar in pixels
var startY = 262 //set y offset of bar in pixels
var verticalpos="fromtop" //enter "fromtop" or "frombottom"

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function get_cookie(Name) {
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) {
offset += search.length
end = document.cookie.indexOf(";", offset);
if (end == -1) end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(off set, end))
}
}
return returnvalue;
}

function closebar(){
if (persistclose)
document.cookie="remainclosed=1"
document.getElementById("topbar").style.visibility ="hidden"
}

function staticbar(){
barheight=document.getElementById("topbar").offset Height
var ns = (navigator.appName.indexOf("Netscape") != -1) || window.opera;
var d = document;
function ml(id){
var el=d.getElementById(id);
if (!persistclose || persistclose && get_cookie("remainclosed")=="")
el.style.visibility="visible"
if(d.layers)el.style=el;
el.sP=function(x,y){this.style.left=x+"px";this.st yle.top=y+"px";};
el.x = startX;
if (verticalpos=="fromtop")
el.y = startY;
else{
el.y = ns ? pageYOffset + innerHeight : iecompattest().scrollTop + iecompattest().clientHeight;
el.y -= startY;
}
return el;
}
window.stayTopLeft=function(){
if (verticalpos=="fromtop"){
var pY = ns ? pageYOffset : iecompattest().scrollTop;
ftlObj.y += (pY + startY - ftlObj.y)/8;
}
else{
var pY = ns ? pageYOffset + innerHeight - barheight: iecompattest().scrollTop + iecompattest().clientHeight - barheight;
ftlObj.y += (pY - startY - ftlObj.y)/8;
}
ftlObj.sP(ftlObj.x, ftlObj.y);
setTimeout("stayTopLeft()", 10);
}
ftlObj = ml("topbar");
stayTopLeft();
}

if (window.addEventListener)
window.addEventListener("load", staticbar, false)
else if (window.attachEvent)
window.attachEvent("onload", staticbar)
else if (document.getElementById)
window.onload=staticbar
</script>

El siguiente codigo tiene que introducirse entre las etiquetas <body>

<div id="topbar">
<a href="" onClick="closebar(); return false"><img src="IMAGEN CLOSE - CERRAR" border="0" width="25"/></a>

AQUI EL CODIGO HTML, JS, ETC ETC, QUE QUIERAS
</div>

Por cierto, NO es una ventana emergente, se llama MODAL WINDOW... ;)

Etiquetas: emergente, ventanas
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 21:43.