473,395 Members | 1,343 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Div layer switching

JS
Hi all,
Im having some troubles with layers on a site im developing.
I have two layers one has an image of an artists palette on it and each blob
of paint is a link to a page on the site. That uses an image map and hrefs.

The second layer is where the page will appear. So when a user clicks a link
on the palette image, a new 'window' will appear over the palette to show
the content. The image of the palette will be slightly faded out to
highlight the content.

The trouble I'm having is switching between the layers when a link is
clicked. The image map links dont seem to show the content window or even be
clickable.

Im not sure if Im going about this the right way though because I also need
to be able to close the content window to show the menu again. If anyone has
any ideas on how to achieve this or any pointers then I would be happy to
know them coz I'm stumped.

The code for the page so far is below and the I know this code may seem a
bit of a mess but I've been trying everything so its a little un-organised.
I've used the z-Index
and visibility alone and together and no sucess so far.

If you need any further info then let me know.
Thanks in advance for your help
James
Scroll down for the code

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Document 1</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="main.css"/ >
<script language="javascript" type="text/javascript">
function openwindow(elm)
{
window.document.getElementById("content").style.vi sibility="hidden";
window.document.getElementById("content").style.zI ndex = "0";
window.document.getElementById("palette").style.vi sibility="hidden";
window.document.getElementById("palette").style.zI ndex = "0";
window.document.getElementById(elm).style.visibili ty="visible";
window.document.getElementById(elm).style.zIndex = "100";
}
</script>
</head>

<body topmargin="0" marginwidth="0" marginheight="0"
onLoad="javascript:openwindow('palette')">

<table width="579" height="582" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<div id="palette" class="palette" name="palette" style="visibility:
hidden; z-Index: 0">
<img src="images/backgroundpalette.png" border="0"
usemap="#paletteMap" start="fileopen" target="#frame">
</div>
<div name="content" id="content" class="content" style="visibility:
hidden; z-Index: 0">
<iframe src="home.htm" frameborder="0" width="579" height="582"
allowtransparency="true"/>
</div>

</td>
</tr>
</table>
<map name="paletteMap" id="paletteMap">
<area shape="circle" coords="478,177,46" href="home.htm" target="#frame"
alt="Homepage" onClick="javascript:openwindow('content')">
<area shape="circle" coords="183,281,50" href="gallery.htm"
target="#frame" alt="Gallery" onClick="javascript:openwindow('content')">
<area shape="circle" coords="311,489,49" href="links.htm" target="#frame"
alt="Links" onClick="javascript:openwindow('content')">
<area shape="circle" coords="323,160,50" href="about.htm" target="#frame"
alt="About Me" onClick="javascript:openwindow('content'))">
<area shape="circle" coords="150,389,49" href="events.htm" target="#frame"
alt="Events" onClick="javascript:openwindow('content')">
<area shape="circle" coords="184,502,56" href="contact.htm"
target="#frame" alt="Contact Me" onClick="javascript:openwindow('content')">
</map>
</body>
</html>

Jan 11 '07 #1
2 2532

JS escreveu:
Hi all,
Im having some troubles with layers on a site im developing.
I have two layers one has an image of an artists palette on it and each blob
of paint is a link to a page on the site. That uses an image map and hrefs.

The second layer is where the page will appear. So when a user clicks a link
on the palette image, a new 'window' will appear over the palette to show
the content. The image of the palette will be slightly faded out to
highlight the content.

The trouble I'm having is switching between the layers when a link is
clicked. The image map links dont seem to show the content window or even be
clickable.

Im not sure if Im going about this the right way though because I also need
to be able to close the content window to show the menu again. If anyone has
any ideas on how to achieve this or any pointers then I would be happy to
know them coz I'm stumped.

The code for the page so far is below and the I know this code may seem a
bit of a mess but I've been trying everything so its a little un-organised.
I've used the z-Index
and visibility alone and together and no sucess so far.

If you need any further info then let me know.
Thanks in advance for your help
James
Scroll down for the code

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Document 1</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="main.css"/ >
<script language="javascript" type="text/javascript">
function openwindow(elm)
{
window.document.getElementById("content").style.vi sibility="hidden";
window.document.getElementById("content").style.zI ndex = "0";
window.document.getElementById("palette").style.vi sibility="hidden";
window.document.getElementById("palette").style.zI ndex = "0";
window.document.getElementById(elm).style.visibili ty="visible";
window.document.getElementById(elm).style.zIndex = "100";
}
</script>
</head>

<body topmargin="0" marginwidth="0" marginheight="0"
onLoad="javascript:openwindow('palette')">

<table width="579" height="582" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<div id="palette" class="palette" name="palette" style="visibility:
hidden; z-Index: 0">
<img src="images/backgroundpalette.png" border="0"
usemap="#paletteMap" start="fileopen" target="#frame">
</div>
<div name="content" id="content" class="content" style="visibility:
hidden; z-Index: 0">
<iframe src="home.htm" frameborder="0" width="579" height="582"
allowtransparency="true"/>
</div>

</td>
</tr>
</table>
<map name="paletteMap" id="paletteMap">
<area shape="circle" coords="478,177,46" href="home.htm" target="#frame"
alt="Homepage" onClick="javascript:openwindow('content')">
<area shape="circle" coords="183,281,50" href="gallery.htm"
target="#frame" alt="Gallery" onClick="javascript:openwindow('content')">
<area shape="circle" coords="311,489,49" href="links.htm" target="#frame"
alt="Links" onClick="javascript:openwindow('content')">
<area shape="circle" coords="323,160,50" href="about.htm" target="#frame"
alt="About Me" onClick="javascript:openwindow('content'))">
<area shape="circle" coords="150,389,49" href="events.htm" target="#frame"
alt="Events" onClick="javascript:openwindow('content')">
<area shape="circle" coords="184,502,56" href="contact.htm"
target="#frame" alt="Contact Me" onClick="javascript:openwindow('content')">
</map>
</body>
</html>
Hi James,
Try this
<script type="text/javascript">
var events = {};
events.prototype = {
activeDiv:null,
toggle:function(div){
if(this.activeDiv != null){
document.getElementById(this.activeDiv).style.disp lay =
'none';
}
document.getElementById(div).style.display='block' ;
}
}
</script>
In onclick event just tipe events.toggle('myDivId').
<area shape="circle" coords="150,389,49" href="events.htm"
target="#frame" alt="Events" onClick="events.toggle('myDivId')">

Filipe Tomita

Jan 11 '07 #2
JS
Thanks Filipe but am I missing something because it still doesn't work. The
new code is below. If it cant be dont with divs is there another way maybe.
It needs to work in Firefox and IE 6+.
Many thanks all
James

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled 1</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="main.css"/ >
<script type="text/javascript">
var events = {};
events.prototype = {
activeDiv:null,
toggle:function(div){
if(this.activeDiv != null){
document.getElementById(this.activeDiv).style.disp lay =
'none';
}
document.getElementById(div).style.display='block' ;
}
}
</script>

</head>

<body topmargin="0" marginwidth="0" marginheight="0">

<table width="579" height="582" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<div id="palette" class="palette" name="palette" style="display:
block;">
<img src="images/backgroundpalette.png" border="0"
usemap="#paletteMap" start="fileopen" target="#frame">
</div>
<div name="content" id="content" class="content" style="display:
none;">
<iframe src="home.htm" frameborder="0" width="579" height="582"
allowtransparency="true"/>
</div>

</td>
</tr>
</table>
<map name="paletteMap" id="paletteMap">
<area shape="circle" coords="478,177,46" href="home.htm" target="#frame"
alt="Homepage" onClick="events.toggle('content')">
<area shape="circle" coords="183,281,50" href="gallery.htm"
target="#frame" alt="Gallery" onClick="events.toggle('content')">
<area shape="circle" coords="311,489,49" href="links.htm" target="#frame"
alt="Links" onClick="javascript:events.toggle('content')">
<area shape="circle" coords="323,160,50" href="about.htm" target="#frame"
alt="About Me" onClick="events.toggle('content')">
<area shape="circle" coords="150,389,49" href="events.htm" target="#frame"
alt="Events" onClick="events.toggle('content')">
<area shape="circle" coords="184,502,56" href="contact.htm"
target="#frame" alt="Contact Me" onClick="events.toggle('content')">
</map>
</body>
</html>
--

"Filipe Tomita" <fi***********@gmail.comwrote in message
news:11**********************@o58g2000hsb.googlegr oups.com...
>
JS escreveu:
Hi all,
Im having some troubles with layers on a site im developing.
I have two layers one has an image of an artists palette on it and each
blob
of paint is a link to a page on the site. That uses an image map and
hrefs.

The second layer is where the page will appear. So when a user clicks a
link
on the palette image, a new 'window' will appear over the palette to
show
the content. The image of the palette will be slightly faded out to
highlight the content.

The trouble I'm having is switching between the layers when a link is
clicked. The image map links dont seem to show the content window or
even be
clickable.

Im not sure if Im going about this the right way though because I also
need
to be able to close the content window to show the menu again. If anyone
has
any ideas on how to achieve this or any pointers then I would be happy
to
know them coz I'm stumped.

The code for the page so far is below and the I know this code may seem
a
bit of a mess but I've been trying everything so its a little
un-organised.
I've used the z-Index
and visibility alone and together and no sucess so far.

If you need any further info then let me know.
Thanks in advance for your help
James
Scroll down for the code

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Document 1</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="main.css"/ >
<script language="javascript" type="text/javascript">
function openwindow(elm)
{
window.document.getElementById("content").style.vi sibility="hidden";
window.document.getElementById("content").style.zI ndex = "0";
window.document.getElementById("palette").style.vi sibility="hidden";
window.document.getElementById("palette").style.zI ndex = "0";
window.document.getElementById(elm).style.visibili ty="visible";
window.document.getElementById(elm).style.zIndex = "100";
}
</script>
</head>

<body topmargin="0" marginwidth="0" marginheight="0"
onLoad="javascript:openwindow('palette')">

<table width="579" height="582" border="0" cellpadding="0"
cellspacing="0">
<tr>
<td>
<div id="palette" class="palette" name="palette" style="visibility:
hidden; z-Index: 0">
<img src="images/backgroundpalette.png" border="0"
usemap="#paletteMap" start="fileopen" target="#frame">
</div>
<div name="content" id="content" class="content"
style="visibility:
hidden; z-Index: 0">
<iframe src="home.htm" frameborder="0" width="579" height="582"
allowtransparency="true"/>
</div>

</td>
</tr>
</table>
<map name="paletteMap" id="paletteMap">
<area shape="circle" coords="478,177,46" href="home.htm"
target="#frame"
alt="Homepage" onClick="javascript:openwindow('content')">
<area shape="circle" coords="183,281,50" href="gallery.htm"
target="#frame" alt="Gallery"
onClick="javascript:openwindow('content')">
<area shape="circle" coords="311,489,49" href="links.htm"
target="#frame"
alt="Links" onClick="javascript:openwindow('content')">
<area shape="circle" coords="323,160,50" href="about.htm"
target="#frame"
alt="About Me" onClick="javascript:openwindow('content'))">
<area shape="circle" coords="150,389,49" href="events.htm"
target="#frame"
alt="Events" onClick="javascript:openwindow('content')">
<area shape="circle" coords="184,502,56" href="contact.htm"
target="#frame" alt="Contact Me"
onClick="javascript:openwindow('content')">
</map>
</body>
</html>
Hi James,
Try this
<script type="text/javascript">
var events = {};
events.prototype = {
activeDiv:null,
toggle:function(div){
if(this.activeDiv != null){
document.getElementById(this.activeDiv).style.disp lay =
'none';
}
document.getElementById(div).style.display='block' ;
}
}
</script>
In onclick event just tipe events.toggle('myDivId').
<area shape="circle" coords="150,389,49" href="events.htm"
target="#frame" alt="Events" onClick="events.toggle('myDivId')">

Filipe Tomita

Jan 12 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: PAD | last post by:
I have written a javascript routine that populates a parent document with a series of <iframe>s. Each <iframe> receives its contents from a series of separate smaller HTML files. Of course my NN...
87
by: expertware | last post by:
Dear friends, My name is Pamela, I know little about CSS, but I would like to ask a question I have an image on a web page within a css layer: <DIV ID=MyLayer STYLE = "position:...
2
by: asad | last post by:
hello, how ru all pls tell me how can i create DAL and how can i use it in my ASP.NET pages thanks
1
by: rbg | last post by:
Hi, I am trying to understand the layering concept with the ASP.NET 2.0 apps. I have a ASP.NET 2.0 Web app which has 3 layers Presentation layer which contains UI elements and Input...
16
by: MS newsgroup | last post by:
I don't have clear reasons why we need business logic layer and data logic layer instead of having only data logic layer. Are there any good reasons for that?
3
by: Qingdong Z. | last post by:
I know this is a silly question, but I am looking for the best way. I build a windows application with standard version and enterprise version. Standard version use local SQL/Access as database....
2
by: funkiejunkie | last post by:
Hello all, I posted a thread a while ago and was told to include the code so here it is. I still dont really get CSS, everything I have done has been blagged because I cant be bothered to read...
8
by: morleyc | last post by:
Hi, until recently i was quite happy to add data sources from mssql database in visual studio and drag the datasets directly onto the form this creating a directly editable form which worked well....
8
by: andre rodier | last post by:
Hello, As indicated in the title, I am looking for a PHP library able to create on the fly complex SQL requests, on 5 or 6 dimensions, without problems occurs on many-to-many relations, etc. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.