Jump to content

visibility, javascript and css


astralaaron

Recommended Posts

is there anything wrong with this picture? why isnt it working?

<html><head><link rel="stylesheet" style="text/css" href="hide.css"/></head><script type="text/javascript" />function openx() {v = document.getElementById('one');v.style.visibility = 'visible';}</script><body><div id="one" onmouseover="openx()" ><p>testing.</p></div></body></html>

#one div{	position: absolute;	visibility: hidden;	margin: 60;	padding: 20;	width: 200px;	height: 100px;	background: #EAEBD8;	border: 1px solid #5970B2}

Link to comment
Share on other sites

So basically what you're trying to do is that when the user mouses over the thing, it shows the thing, right? First, might i say, bit weird. kinda silly. How am i, the user, supposed to know im hovering over something? Also, why not just make a simplier function:

function open(item){   if(item==null || item==undefined){	 return;   }   item = (item.constructor=='string') ? document.getElementById(item) : item;   if(item.style.visibilty=='hidden'){	  item.style.visibility='';	}else{	  item.style.visibility='hidden';	}}...<div id="thing" onmouseover="open(this)"> Hi you</div>

Link to comment
Share on other sites

<html><head><link rel="stylesheet" style="text/css" href="hide.css"/></head><body><script type="text/javascript" />function open(item){   if(item==null || item==undefined){     return;   }   item = (item.constructor=='string') ? document.getElementById(item) : item;   if(item.style.visibilty=='hidden'){      item.style.visibility='';    }else{      item.style.visibility='hidden';    }}</script><div id="thing" onmouseover="open(this)">Hi you</div></body></html>

i tried this... when the document loads i can see "hi you" in the corner.. when i mouse over 'hi you' = disapears

Link to comment
Share on other sites

<html><head><link rel="stylesheet" style="text/css" href="hide.css"/></head><body><script type="text/javascript" />function open(item, visible){if(item==null || item==undefined){return;}item = (item.constructor=='string') ? document.getElementById(item) : item;if(visible){item.style.visibility='';}else{item.style.visibility='hidden';}}</script><div id="thing" onmouseover="open(this, true)">Hi you</div>

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...