Foros del Web » Programando para Internet » Javascript »

menu cargar div evento on click y cargar iframe

Estas en el tema de menu cargar div evento on click y cargar iframe en el foro de Javascript en Foros del Web. hola amigos estaba tratando de hacer un código para cargar un Div con desde botones con eventos onclick pero no me sale a ver si ...
  #1 (permalink)  
Antiguo 03/11/2011, 09:30
Avatar de arcanisgk122  
Fecha de Ingreso: junio-2010
Mensajes: 755
Antigüedad: 13 años, 10 meses
Puntos: 28
menu cargar div evento on click y cargar iframe

hola amigos estaba tratando de hacer un código para cargar un Div con desde botones con eventos onclick pero no me sale a ver si alguien tiene alguna idea al respecto que me ayude o me indique el error.

xhtml:

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">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Sin título 1</title>
		<script type="text/javascript" src="menu.js"></script>
</head>

<body>
<table style="width: 740px; background-color:gray">
<tr>
<td class="tdpg3 td10">
<input class="imp3" type="button" onclick="mostrar(atri)" id="1" value="Atributos" />
</td>
<td class="tdpg3 td10">
<input class="imp3" type="button" onclick="mostrar(habi)" id="2" value="Habilidades" />
</td>
</tr>
</table>
<div id="atri" name="atri" class="div3" style="width: 740px; height: 500px; visibility: hidden;">
<iframe class="ifr1" src="atri.html" frameborder="0" style="width: 740px; height: 500px;"></iframe>
</div>
<div id="habi" name="habi" class="div3" style="width: 740px; height: 500px; visibility: hidden;">
<iframe class="ifr1" src="habi.html" frameborder="0" style="width: 740px; height: 500px;"></iframe>
</div>

</body>

</html> 
Funcion que muestra el div o lo oculta:
Código PHP:
function mostrar(x){
    var 
obj document.getElementById(x)
    if(
obj.style.visibility== "hidden"){
        
obj.style.visibility"visible";
    }else{
        
obj.style.visibility"hidden"
    }

__________________
Cooler Master Gladiator 600 - AMD PHENOM II X4 955 @ 3.5GHZ
GA-MA78GM-US2H - Super Talent 800 2GB x 2 Dual, (Unganged)
PSU Cooler Master eXtreme Power Plus 500W - Saphire R7-260OC-2GB
  #2 (permalink)  
Antiguo 03/11/2011, 09:45
 
Fecha de Ingreso: mayo-2010
Mensajes: 118
Antigüedad: 13 años, 11 meses
Puntos: 1
Respuesta: menu cargar div evento on click y cargar iframe

Por lo que he aprendido aqui, las funciones con parametros de texto llevan comillas, funcion('parametro'), si lo haces asi funciona correctamente.

Código HTML:
<td class="tdpg3 td10">
<input class="imp3" type="button" onclick="mostrar('atri')" id="1" value="Atributos" />
</td>
<td class="tdpg3 td10">
<input class="imp3" type="button" onclick="mostrar('habi')" id="2" value="Habilidades" />
</td> 
  #3 (permalink)  
Antiguo 03/11/2011, 23:45
Avatar de arcanisgk122  
Fecha de Ingreso: junio-2010
Mensajes: 755
Antigüedad: 13 años, 10 meses
Puntos: 28
Respuesta: menu cargar div evento on click y cargar iframe

gracias ya esta arreglado
__________________
Cooler Master Gladiator 600 - AMD PHENOM II X4 955 @ 3.5GHZ
GA-MA78GM-US2H - Super Talent 800 2GB x 2 Dual, (Unganged)
PSU Cooler Master eXtreme Power Plus 500W - Saphire R7-260OC-2GB

Etiquetas: evento, funcion, html, iframe, js, botones
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 17:21.