basicly, i ned a smiple script that will toggle a layer (div), i know i can toggle it with the document.getElementById, but i only want one link, so when you click the link the layer becomes visible, then click the same link to hide the layer
any help would be apreciated,
--sva--
Toggeling Layers....with javascript in NS6
Page 1 of 1
4 Replies - 6605 Views - Last Post: 17 July 2002 - 11:01 AM
Replies To: Toggeling Layers..
#2
Re: Toggeling Layers..
Posted 16 July 2002 - 07:28 PM
Dreamweaver has built-in functions for hiding/showing layers as well as dragging them around the browser. They may not be the best there is but they work. Attached is an htm file of a basic example of the show-hide layer behavior using text links:
Attached File(s)
-
layers.htm (1.73K)
Number of downloads: 585
#3
Re: Toggeling Layers..
Posted 16 July 2002 - 07:30 PM
I just realized that you specified that you want the same link to toggle the hide/show. The example I have above is 2 seperate links. sorry
#4
Re: Toggeling Layers..
Posted 16 July 2002 - 09:47 PM
I'm not very good with javascript but I know a bit, here's somthing I just tried to do for ya, it works 
<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title> New Document </title>
<script language="Javascript">
function toggle () {
if (id_name1.style.display == "none") {
id_name1.style.display = '';
id_name2.style.display = 'none';
}
else {
id_name1.style.display = 'none';
id_name2.style.display = '';
}
}
</script>
</head>
<a href="[url=http://www.dreamincode.net/forums/forum/32-java/]Java[/url] script:toggle()">Toggle!</a><br><br>
<table style="display: ''" id="id_name1">
<tr>
<td>Toggling, wheeeeeeeeeeeeeeee!</td>
</tr>
</table>
<table style="display: 'none'" id="id_name2">
<tr>
<td>Toggling, wheeee!</td>
</tr>
</table>
<body>
</body>
</html>
Attached File(s)
-
toggle.html (678bytes)
Number of downloads: 554
Page 1 of 1
|
|

New Topic/Question
Reply


MultiQuote




|