Subject: Question on document objects
Posted By: chadlupkes Post Date: 9/21/2003 7:49:31 PM
Hi everyone,

I'm just starting in Javascript, and I'm trying to get this to work.
I have three image maps that I am trying to allow people to choose
from, and I'd rather not have three separate pages to flip through.
I'm thinking that if I create an array, I can dynamically assign
values to the title of the map, the img file source, and the name of
the image map to use.  Here is my array:

<script language="JavaScript" type="text/javascript">
function map_onlick()
{
var whichMap = new Array();

whichMap[0] = new Array();
whichMap[0][0] = "World Map";
whichMap[0][1] = "/atctestsite/affiliates/gifs/world15.gif";
whichMap[0][2] = "worldmap";

whichMap[1] = new Array();
whichMap[1][0] = "North America";
whichMap[1][1] = "/atctestsite/affiliates/gifs/northamerica.gif";
whichMap[1][2] = "northamerica";

whichMap[2] = new Array();
whichMap[2][0] = "United States";
whichMap[2][1] = "/atctestsite/affiliates/gifs/usa_color.gif";
whichMap[2][2] = "unitedstates";
}
</script>

Now, with this defined, I should be able to choose which one to use,
and change the objects in the body of the document to the resulting
values.  The problem is, I'm having trouble finding a good description
of how to define objects like Headers and imagemaps.  I would like to
be able to use the basic document objects, but if I create the header
like this:

<h1 name="title1">World Map</h1>

how do I change that to either "North America" or "United States" if
the correct link is chosen?  I can see that this will be a function
call, probably called when the onclick() event is seen, but I'm
getting lost how to go any further.

Anyone have any ideas?

Chad Lupkes
chadlupkes@earthlink.net

Chad Lupkes
chadlupkes@yahoo.com
http://www.seattlewebcrafters.com
Reply By: melvik Reply Date: 9/22/2003 12:06:17 AM
Hi there!
For header u can use <span> like <h1 name="title1"><span id="header">World Map</span></h1> & then work with innerHTML of span! check <span> samples & u'll get what im talking about!
about image, its same! give an ID for <image> & then change the src attribute for that.

HTH & keep me inform.

Always,
Hovik Melkomian.

Go to topic 4374

Return to index page 1041
Return to index page 1040
Return to index page 1039
Return to index page 1038
Return to index page 1037
Return to index page 1036
Return to index page 1035
Return to index page 1034
Return to index page 1033
Return to index page 1032