By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,466 Members | 1,148 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,466 IT Pros & Developers. It's quick & easy.

Question on JavaScript Objects

P: n/a
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
ch********@earthlink.net
Jul 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
ok i sort of see what your doing - you want to dynamically change the name
of the h1 tag .

function changeTag(x){ // x will be your first element number in your multi
dimentional array
title1.innerTEXT = whichMap[x][0]
}

hope this helps

Simon Christie


"Chad Lupkes" <ch********@yahoo.com> wrote in message
news:8b*************************@posting.google.co m...
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
ch********@earthlink.net

Jul 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.