Ver Mensaje Individual
  #1 (permalink)  
Antiguo 03/11/2011, 09:30
Avatar de arcanisgk122
arcanisgk122
 
Fecha de Ingreso: junio-2010
Mensajes: 755
Antigüedad: 13 años, 11 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