473,385 Members | 1,588 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,385 software developers and data experts.

Changing the content of a layer

Hi there,

wondered if someone could point me to an appropriate tutorial or offer
advice on the following problem?

I've got a web page which uses lots of divs to position the content of the
page and I'm using a nice javascript to alter the css of a table of links.
The thing is I don't want the table of links to point to an external site
but to calla function which will replace the content of a layer... perhaps
it's be better if I showed you the code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title></title>
<style type="text/css">
.cellButton{width:80px;background-color:#A9A9A9;color:#000000;border:#FFFFFF
1px solid;cursor:pointer;}
.cellButton2{width:80px;background-color:#C8C8C8;color:#000000;border:#FFFFFF
1px solid;cursor:pointer;}
</style>
<script language="Javascript">
function overView(that){that.className = 'cellButton2';}
function outView(that){that.className = 'cellButton';}
</script>
</head>
<body style="background-color:#000000;">
<div
style="position:absolute;left:50%;top:50%;margin-top:-200px;margin-left:-300px;width:150px;height:400px;">
<a href="#">
<img style="width:150px;height:400px;border-style:none;" alt="left"
src="left.gif"/>
</a>
</div>
<div
style="position:absolute;left:50%;top:50%;margin-top:-190px;margin-left:-140px;width:150px;height:400px;">
<img style="width:280px;height:380px;" alt="left" src="blank.gif"/>
</div>
<div style="position:absolute; left: 50%; top: 50%; margin-top: -200px;
margin-left: -150px; width: 300px; height: 400px;">
<img style="width:300px;height:400px;" alt="" src="middle.gif"/>
</div>
<div style="position:absolute; left: 50%; top: 50%; margin-top: -200px;
margin-left: 150px; width: 150px; height: 400px;">
<a href="#">
<img style="width:150px;height:400px;border-style:none;" alt="right"
src="right.gif"/>
</a>
</div>
<div
style="position:absolute;left:50%;top:50%;margin-top:-170px;margin-left:-120px;width:240px;">
<table
style="text-align:center;font-family:monospace;background-color:#C8C8C8;width:240px;"
border="1px" cellspacing="3px" cellpadding="2px">
<tbody>
<tr>
<td class="cellButton" onmouseover="overView(this);"
onmouseout="outView(this);" onclick="location.href='#';">What</td>
<td class="cellButton" onmouseover="overView(this);"
onmouseout="outView(this);" onclick="location.href='#';">Why</td>
<td class="cellButton" onmouseover="overView(this);"
onmouseout="outView(this);" onclick="location.href='#';">When</td>
</tr>
</tbody>
</table>
</div>
<div
style="position:absolute;left:50%;top:50%;margin-top:-130px;margin-left:-250px;width:500px;">
<p>
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean non risus
in lorem convallis tempor. Ut viverra condimentum arcu. Donec posuere augue
id turpis. Donec lacinia fringilla pede. Maecenas eleifend. Ut mi velit,
mollis ut, luctus eget, condimentum ut, neque. Vivamus sodales pulvinar
magna. Ut dictum mi a risus. Maecenas ultricies erat luctus leo. Quisque
dolor. Nam dolor est, egestas ac, pellentesque eu, interdum sagittis, nulla.
Quisque non eros. Morbi malesuada commodo lacus. Pellentesque odio ante,
dapibus id, consequat nec, accumsan sit amet, lectus.
</p>
<p>
Etiam sit amet leo sed enim suscipit sodales. Donec ipsum. Suspendisse eget
velit eget nunc iaculis dapibus. Fusce libero. Sed eu lectus. In massa leo,
egestas nec, pulvinar tincidunt, cursus feugiat, magna. Praesent sagittis,
wisi eget dignissim tempus, wisi mauris vestibulum velit, quis convallis
velit sapien cursus nisl. Pellentesque blandit urna non neque. Cum sociis
natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.
Pellentesque lectus libero, convallis non, eleifend vel, condimentum sed,
felis.
</p>
</div>
</body>
</html>

So what I want to do is dynamically alter or replace the "Lorem ipsum"
paragraphs with some other arbitrary text when the "What", "Why" or "When"
buttons are pressed.

Any ideas or links will be greatly appreciated,

Cheers,

Dom
Jul 23 '05 #1
2 1683
"Dominic Myers" <an***********@msn.com> wrote in message
news:2r*************@uni-berlin.de
Hi there,

wondered if someone could point me to an appropriate tutorial or offer
advice on the following problem?

I've got a web page which uses lots of divs to position the content
of the
page and I'm using a nice javascript to alter the css of a table of
links.
The thing is I don't want the table of links to point to an external
site
but to calla function which will replace the content of a layer...


Add to the Lorem Ipsum element
<div id="loremipsum" style=etc...

Then, somewhere in your javascript (this will wrap but is meant to be all on
one line.)

document.getElementById('loremipsum').innerHTML = "<p>This is the new HTML
code.</p>"

Although javascript is available for just about every browser I've come
across it isn't always enabled so the above will fail on those browsers. It
will also fail if their browser (or User Agent) doesn't support
getElementById or innerHTML.
Make sure you've got a fall-back facility if you want to accommodate them.
eg: click here to view the information in plain text.
Jul 23 '05 #2
"PDannyD" <da*****@REMOVETHISBITscenicplace.freeserve.co.u k> wrote in
message news:ci**********@newsg2.svr.pol.co.uk...
"Dominic Myers" <an***********@msn.com> wrote in message
news:2r*************@uni-berlin.de
Hi there,

wondered if someone could point me to an appropriate tutorial or offer
advice on the following problem?

I've got a web page which uses lots of divs to position the content
of the
page and I'm using a nice javascript to alter the css of a table of
links.
The thing is I don't want the table of links to point to an external
site
but to calla function which will replace the content of a layer...


Add to the Lorem Ipsum element
<div id="loremipsum" style=etc...

Then, somewhere in your javascript (this will wrap but is meant to be all
on
one line.)

document.getElementById('loremipsum').innerHTML = "<p>This is the new HTML
code.</p>"

Although javascript is available for just about every browser I've come
across it isn't always enabled so the above will fail on those browsers.
It
will also fail if their browser (or User Agent) doesn't support
getElementById or innerHTML.
Make sure you've got a fall-back facility if you want to accommodate them.
eg: click here to view the information in plain text.


You are indeed a true diamond, thank you very much!

Dom
Jul 23 '05 #3

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

Similar topics

3
by: Catherine Lynn Smith | last post by:
I am creating a webpage with dhtml <DIV> layers and I want a link on one layer to modify the content on another but I seem to keep running into errors. Basically I create a layer in the middle...
14
by: Brandon Hoppe | last post by:
I'm trying to change the src of an ilayer in the parent document from a link inside the ilayer. I'm not able to get it to work. All that happens is Netscape 4 crashes. This is for Netscape 4 only....
6
by: iwearwatches | last post by:
Group, What a root canal. Here is what I have: I have a page that has several layers that I will either show/hide based on a graphic/tab that the user clicks. (works perfectly)
7
by: Brett Romero | last post by:
I'd like to copy a object1 into object2 so object2 can be manipulated. Object1 is coming form the middle layer into the UI layer. I'd like to rename a field in Object2 from "somethingID" to just...
0
by: Rahul | last post by:
I have some resx files inside my Global Resources folder for the web and some other Resx files for the DataAccess layer project .For web project I am using Resx files for the Form control's...
2
by: l!m!t | last post by:
Hello, I hope somebody can help me I have been at this for hours. I am new to JavaScript. I need a script to show a layer of hidden content only when on a certain URL. I have searched and...
7
by: petethebloke | last post by:
Can anyone help? I have a client who has made a "dynamic interactive map" of our city using Dreamweaver. Each map file has hotspots that pop-up a div with a little image when the mouse goes over...
4
by: gubbachchi | last post by:
Hi all, Please anybody help me solve this problem. I am stuck up with this from past 2 weeks. I am developing an application where, when the user selects date from javascript datepicker and enters...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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,...

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.