First web site - need help with javascript

P

Peter Jones

Hi,
I'm in the process of designing a web site for my wedding. This is my
first attempt at web design of any sort. I have the basic design done
and I am now at the point where I want to start adding some content. I
am having a problem with one page, the URL is:

http://www.peterj1974.plus.com/weddingdetails.htm

The left hand side will be link and I want the content to be displayed
in the main area. So for example, when someone clicks on ceremony, the
information on the ceremony will be displayed etc etc. I'd like to try
and do this with out creating a separate page for each menu item. Is
this possible, if so can some one give me some instructions.

Thanks
 
R

Reply Via Newsgroup

Peter said:
Hi,
I'm in the process of designing a web site for my wedding. This is my
first attempt at web design of any sort. I have the basic design done
and I am now at the point where I want to start adding some content. I
am having a problem with one page, the URL is:

http://www.peterj1974.plus.com/weddingdetails.htm

The left hand side will be link and I want the content to be displayed
in the main area. So for example, when someone clicks on ceremony, the
information on the ceremony will be displayed etc etc. I'd like to try
and do this with out creating a separate page for each menu item. Is
this possible, if so can some one give me some instructions.

Thanks

As a quick answer I would think you would not have to use javascript to
get where you want to go - Instead, you could use an IFRAME to the right
of your menu - Give it a name (for example, call it WORKAREA) then, use
TARGET=WORKAREA in your links on the right...

Does that help you any?

randelld
 
K

kaeli

Hi,
I'm in the process of designing a web site for my wedding. This is my
first attempt at web design of any sort. I have the basic design done
and I am now at the point where I want to start adding some content. I
am having a problem with one page, the URL is:

http://www.peterj1974.plus.com/weddingdetails.htm

The left hand side will be link and I want the content to be displayed
in the main area. So for example, when someone clicks on ceremony, the
information on the ceremony will be displayed etc etc. I'd like to try
and do this with out creating a separate page for each menu item. Is
this possible, if so can some one give me some instructions.

Sure, assuming supporting recent DOM browsers such as IE and Netscape 6+
are sufficient for this personal site.

Make a div and give it an ID.
<div id="main"></div>

When someone clicks a link, call a javascript function that writes the
appropriate content to the div.
<a href="#" onClick="writeContent('Ceremony');return false;">Ceremony
</a>

The innerHTML property should suffice if we're keeping this simple.

(watch for word wrap)

function writeContent(which)
{
if (document.getElementById)
{
if (which == 'Ceremony')
{
document.getElementById("main").innerHTML = "some string of text
etc";
}
else if (which == 'Reception')
{
document.getElementById("main").innerHTML = "some other string of
text etc";
}
}
}

You can get fancy by storing the values for the various links in an
array and referencing that instead. It's easier to modify, but a tad
more complicated to "get" if you're new to programming.

HTH

--
--
~kaeli~
Those who get too big for their britches will be exposed in
the end.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,189
Latest member
CryptoTaxSoftware

Latest Threads

Top