Wrox Programmer Forums
|
BOOK: Beginning JavaScript
This is the forum to discuss the Wrox book Beginning JavaScript by Paul Wilton; ISBN: 9780764544057
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning JavaScript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 21st, 2003, 07:49 PM
Registered User
 
Join Date: Sep 2003
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to chadlupkes Send a message via Yahoo to chadlupkes
Default Question on document objects

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
[email protected]

Chad Lupkes
[email protected]
http://www.seattlewebcrafters.com
 
Old September 22nd, 2003, 12:06 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 996
Thanks: 2
Thanked 11 Times in 11 Posts
Send a message via Yahoo to melvik
Default

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.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Value objects rayback_2 BOOK: Beginning Cryptography with Java 1 May 13th, 2008 05:04 PM
Another Document ( ) Function Question bonekrusher XSLT 2 August 4th, 2006 10:45 AM
Create Objects jmss66 VB How-To 5 February 15th, 2006 07:48 PM
Com Objects henryh MySQL 0 July 2nd, 2003 03:56 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.