...

View Full Version : Layer style dont work!!



feras_wilson
10-16-2005, 12:50 PM
If tag don't work, why??



<script>
function hiddenandvalue() {
if(mylayer.style.visibility='hidden')
mytextarea.value="it hidden"
}
</script>
<body onload="hiddenandvalue()">
<textarea name="mytextarea"></textarea>

<a href="#" onclick="mylayer.style.visibility='hidden'">Let layer be hidden</a>
<div style="position: absolute; width: 100px; height: 100px; z-index: 1; left: 107px; top: 96px; visibility:visible" id="mylayer">
my layer is now visible </div>
</body>


Please Help!! :confused:

vwphillips
10-16-2005, 01:19 PM
= assign
== equality


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>
<title></title>
<script>
function hiddenandvalue() {
if(mylayer.style.visibility=='hidden')
mytextarea.value="it hidden"
}
</script>
<body onload="hiddenandvalue()">

<textarea name="mytextarea"></textarea>

<a href="#" onclick="mylayer.style.visibility='hidden'">Let layer be hidden</a>
<div style="position: absolute; width: 100px; height: 100px; z-index: 1; left: 107px; top: 96px; visibility:visible" id="mylayer">
my layer is now visible </div>
</body>

</html>

Kor
10-17-2005, 09:06 AM
and you should use the standard DOM notation, not the IE only shortcuts, to achieve a cross-browser code

document.getElementById('mylayer').style.visibility
...
document.getElementsByName('mytextarea')[0].value

On the other hand I don't see the useness of the code, especially that called onload. It is useless, as onload always the element is visible.

What is in fact you aim?

feras_wilson
10-17-2005, 02:50 PM
thanks



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum