468,121 Members | 1,457 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,121 developers. It's quick & easy.

DOM CSS display:none/block switching hover problem

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN">
<html>
<head>
<title>rolly</title>
<!-- The desired performance for this gem would be to:
1. click on table cells
2. edit in INPUT
3. click away, data presented in table cell.

2.0 The table cells have hover highlighting.

**** Problem: IE
When INPUT is switched to display:block through CSS change,
the INPUT will disappear if another hover is activated.
-->
<style type="text/css">
<!--
table.rolly a { display:block;
width:100%;height:100%;background-color:#ccccff}
table.rolly a:link {}
table.rolly a:visited {}
table.rolly a:hover { background-color:#ccffff; }
table.rolly a:active {}
/* ie cluge: makes a clickable inside td */
table.rolly a div {width:100%;height:100%}
/* no hover */
table.rollypause a { display:block;
width:100%;height:100%;background-color:#ccccff}

..vis { visibility:visible}
input.vis {display:block;}
..hid { visibility:hidden }

/*
..vis { display: block}
input.vis {display:block; border:double 4px #ff0}
..hid { display: none }
*/
-->
</style>
<script type="text/javascript">
///////////////////
function InpEdOn(A){
/////////////////////

// max 1 INPUT in A
var Inpy = A.getElementsByTagName("INPUT")[0];
var Divtext = A.getElementsByTagName("DIV")[0];
Inpy.className = "vis";
Inpy.value = Divtext.firstChild.nodeValue+ " ";
// not working in NN71
Inpy.focus();
Inpy.select();
}

/////////////////////
function InpEdOff(Inp){
/////////////////////

var Divtext = Inp.parentNode.getElementsByTagName("DIV")[0];
var Tagtxt = new Array();

Inp.className = "hid";
Tagtxt = Inp.value;
Divtext.firstChild.nodeValue = Tagtxt.toString();
}
//-->
</script>
</head>
<body>
<form name="formy" onsubmit="return false;">
<table style="width:100%" class="rolly" border="5">
<tr><td style="width:33%">
<div style="display:block; position:relative;">
<a href="#nojump" class="vis" onclick="InpEdOn(this)">
<div>&nbsp;</div>
<input type="text" class="hid" style="position:absolute;
top:150px;left:150px;height:2em"
onblur="InpEdOff(this)"/>
</a>
</div>
</td>
<td><a href="#nojump"><div>1-2</div></a></td>
<td><a href="#nojump"><div>1-3</div></a></td>
</tr>
<tr><td><a href="#nojump"><div>2-1 </div></a></td>
<td><a href="#nojump"><div>2-2</div> </a></td>
<td><a href="#nojump"><div>2-3</div> </a></td>
</tr>
</table>
</form>
<div>1-1</div>
</body>
</html>

</body>
</html>
Jul 23 '05 #1
0 5445

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Jon W | last post: by
1 post views Thread by fleemo17 | last post: by
3 posts views Thread by Erwin Moller | last post: by
18 posts views Thread by didacticone | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.