Comunidad de diseño web y desarrollo en internet online

Quiero cerrar un div sin que se me cierre la pagina entera

Citar            
MensajeEscrito el 21 Ago 2006 05:37 pm
Hola,hay algo que no se como solucionar......
tengo un boton (que esta denrto de un div ...div 1) que llama un div (div 2), que contiene un menu.
he puesto un boton para cerrar el div 2(que contiene el menu) pero cuando lo pincho para cerrarlo, se me cierra la pagina entera.Si me pueden explicar que puedo hacer para que se cierre solo el div y no la pagina entera.......
gracias!

Por tabarich

30 de clabLevel



 

Cuba

firefox
Citar            
MensajeEscrito el 21 Ago 2006 06:53 pm
Qué código tienes?

Por Pedro

BOFH

3017 de clabLevel

3 tutoriales
6 articulos

  Bastard Operators From Hell

Honduras

firefox
Citar            
MensajeEscrito el 21 Ago 2006 07:16 pm
este es todo el codigo que tengo puesto.......
<script language="JavaScript" type="text/JavaScript">


function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
function MM_showHideLayers() { //v6.0
var i,p,v,obj,args=MM_showHideLayers.arguments;
for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
obj.visibility=v; }
}

</script>
<style type="text/css">

<!--
p{ font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; color:#990000; font-weight:bold; }
A:link { TEXT-DECORATION: none }
A:visited { TEXT-DECORATION: none }
A:hover { TEXT-DECORATION: none }
A:active { TEXT-DECORATION: none }
.8links{ width:176px; height:13px;font-family:Verdana, Arial, Helvetica, sans-serif; font-size:9px; color:#990000; text-align:left; }
#Layer1 {
position:absolute;
left:148px;
top:53px;
z-index:1;
width: 15px;
}
#Layer2 {
position:absolute;
left:167px;
top:37px;
z-index:2;
width: 258px;
visibility: hidden; /*visibility: hidden;*/
}

#boton {
position:absolute;
left:157px;
top:32px;
width:16px;
height:12px;

z-index:3;
}
#Layer4 {
position:absolute;
left:61px;
top:123px;
z-index:3;
}
#Layer5 {
position:absolute;
left:61px;
top:140px;
z-index:4;
}
#Layer6 {
position:absolute;
left:61px;
top:157px;
z-index:5;
}
#Layer7 {
position:absolute;
left:61px;
top:174px;
z-index:6;
}
#Layer8 {
position:absolute;
left:61px;
top:192px;
z-index:7;
}
#Layer9 {
position:absolute;
left:61px;
top:209px;
z-index:8;
}
#Layer10 {
position:absolute;
left:61px;
top:226px;
z-index:9;
}
#Layer11 {
position:absolute;
left:61px;
top:243px;
z-index:10;
}
-->
</style>

<div id="Layer2">
<div id="boton"><a href=JavaScript:window.close('Layer2')><img src="file:///C|/Lucia trabajo/CUBAAUTREMENT/PLANTILLAS/imag/bot-x.gif" width="14" height="11" alt="fermer" border="0" /></a></div>
<p><img src="file:///C|/Lucia trabajo/CUBAAUTREMENT/PLANTILLAS/imag/extra.gif" width="227" height="295" alt="" /></p>


<div class="8links" id="Layer4"><img src="file:///C|/Lucia trabajo/CUBAAUTREMENT/PLANTILLAS/imag/bot-ind.gif" width="12" height="11" alt="" />Culture et Traditions</div>
<div class="8links" id="Layer5"><img src="file:///C|/Lucia trabajo/CUBAAUTREMENT/PLANTILLAS/imag/bot-ind.gif" width="12" height="11" alt="" />Sport-Activit&eacute;s</div>
<div class="8links" id="Layer6"><img src="file:///C|/Lucia trabajo/CUBAAUTREMENT/PLANTILLAS/imag/bot-ind.gif" width="12" height="11" alt="" />Bien-&ecirc;tre-D&eacute;tente</div>
<div class="8links" id="Layer7"><img src="file:///C|/Lucia trabajo/CUBAAUTREMENT/PLANTILLAS/imag/bot-ind.gif" width="12" height="11" alt="" />Spectacles-Divertissement</div>
<div class="8links" id="Layer8"><img src="file:///C|/Lucia trabajo/CUBAAUTREMENT/PLANTILLAS/imag/bot-ind.gif" width="12" height="11" alt="" />Sp&eacute;cial enfants</div>
<div class="8links"id="Layer9"><img src="file:///C|/Lucia trabajo/CUBAAUTREMENT/PLANTILLAS/imag/bot-ind.gif" width="12" height="11" alt="" />Sp&eacute;cial couples</div>
<div class="8links" id="Layer10"><img src="file:///C|/Lucia trabajo/CUBAAUTREMENT/PLANTILLAS/imag/bot-ind.gif" width="12" height="11" alt="" />Bonnes affaires</div>
<div class="8links" id="Layer11"><img src="file:///C|/Lucia trabajo/CUBAAUTREMENT/PLANTILLAS/imag/bot-ind.gif" width="12" height="11" alt="" />Luxe</div>
</div>

<div id="menuleft_home">
<ul>
<p>LE SUR-MESURE</p>
<li><a href="file://///Lahavane/newautrenet/inc/zoom.aspx">Zoom Activités</a></li>
<li><a href="#">Voyage à la Carte</a></li>
<li><a href="file://///Lahavane/newautrenet/inc/regiones.aspx">Destination para région</a></li>

<p>LES RÉSERVATIONS</p>
<li><a href="file://///Lahavane/newautrenet/inc/rentacar.aspx">Location de Voiture</a></li>
<li><a href="file://///Lahavane/newautrenet/inc/hoteles.aspx">Hôtels</a></li>
<li><a href="javascript:ficha('http://www.advences.com/mirror/index.cfm?ref=2005042801');">Billets d'Avion</a></li>
</ul>
<div id="Layer1";><a href="#"onclick="MM_showHideLayers('Layer2','','show')">
<img src="file:///C|/Lucia trabajo/CUBAAUTREMENT/PLANTILLAS/imag/bot-ind.gif" width="12" height="11" alt=""border="0" /></a></div>
</div>

Por tabarich

30 de clabLevel



 

Cuba

firefox
Citar            
MensajeEscrito el 21 Ago 2006 07:53 pm
me pueden decir si hay algo mal en mi codigo que cuando pincho el boton para cerrar, se me cierra toda la pagina....
gracias!!!

Por tabarich

30 de clabLevel



 

Cuba

firefox
Citar            
MensajeEscrito el 21 Ago 2006 09:53 pm
Oh por Dios! tabarich, debes usar la etiqueta code del foro de está forma tú código es más legible, mientras tanto, sólo te comento que no debes usar esto:

Código :

<div id="boton"><a href=JavaScript:window.close('Layer2')><img src="file:///C|/Lucia trabajo/CUBAAUTREMENT/PLANTILLAS/imag/bot-x.gif" width="14" height="11" alt="fermer" border="0" /></a></div>


window.close, le dice al navegador que cierre la página, en su lugar usa getElementById y la propiedad visibility, mira, te dejo un ejemplo para que lo estudies y veas que es mejor para tí

http://www.webintenta.com/Mostrar-ocultar-capas-pulsando-sobre-un-enlace.html

Por Aoyama

BOFH

6224 de clabLevel

6 tutoriales
12 articulos

Genero:Masculino   Anime Bloggers Bastard Operators From Hell

Webdesigner & Developer, en mis ratos libres bebo café por litros.

firefox
Citar            
MensajeEscrito el 21 Ago 2006 10:27 pm
gracias Aoyama!!!

Por tabarich

30 de clabLevel



 

Cuba

firefox

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.