Solved

USEMAP with separate map files and database

Posted on 2002-05-21
11
429 Views
Last Modified: 2010-04-09
Hi,

I'm trying to load maps from a separate map file for maintenance purposes.

contents of demo.htm file
-------------------------
<img src="myimage.gif" usemap="canada.htm#canada">

contents of canada.htm file
---------------------------
<map name=canada>
<area name=BritishColumbia shape="rect" coords="0, 0, 250, 250" href="bc.htm">
<area name=Alberta shape="rect" coords="0, 250, 250, 250">
etc etc etc
</map>

can someone PLEASE explain to me why this doesn't work.  Every website I've been to has something similar to this as an example.  Is this functionality that has been dropped from the DOM in recent releases?

I have an ASP page which is built from the content of a table in a database and need to be able to pull the relevant map file for the image.  i.e. if someone selects USA, then I need it to pull the map as well as the coordinate file from the database.  I can get it to build the page without any problems, it's just that when I do this, my imagemaps won't work.

Thanks for any help.
0
Comment
Question by:balabaster
  • 4
  • 4
  • 2
  • +1
11 Comments
 
LVL 22

Expert Comment

by:CJ_S
ID: 7026487
Looks okay to me. Are you sure that the map is correct too?

try:
<img src="myimage.gif" usemap="canada.htm#canada" ISMAP>
0
 
LVL 22

Expert Comment

by:CJ_S
ID: 7026491
Does it work for you, if both the map and image are in the same file?

CJ
0
 
LVL 2

Expert Comment

by:Marianne
ID: 7026588
When I was trying to do the same (and also discussed the problem with other coders), I came to a conclusion that it's impossible.

However when placed in one file, it works just fine.
0
 
LVL 19

Expert Comment

by:webwoman
ID: 7026860
You can do it as an include, that would work.

But try it as a TEXT file, not HTML. Rename the file to canada.txt and see what happens.
0
 

Author Comment

by:balabaster
ID: 7028249
CJ S:  Yes the image and the map both work in the same file.  The only thing is, I have 10 countries in the database currently and would need to include 10 image maps in my html, not something I want to do, as in 2 weeks, I am likely to have 100 countries, and 100 maps, and I don't want 100 maps in my HTML, it's a waste of download time.

----

Leveret: I'm rapidly coming to the same conclusion.  Of course, the HTML 3.2 Specification dictates that it should work, but I guess Microsoft & Netscape in their infinite wisdom decided that design specifications aren't important in this world anyway.  Who am I to argue? I'm just a lowly programmer who just has to work around their shortcomings.

-----

WebWoman: Okay, I understand the include, I can do that...how do I get it to determine which page to include by getting the info from the database?  I've been trying to use this work around, but I can't figure out how.

The following code generates the correct string, but then it promptly decides to dump that literal into the HTML instead of including the file.

Response.Write "<!-- #include virtual="& oRec("MapFile") &" -->"

I understand why it does this, response.write tells it to write that into the HTML, it doesn't tell it to include it as #include does.  Any clues how I would make it include dynamically?
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 19

Accepted Solution

by:
webwoman earned 50 total points
ID: 7028294
You can't. You can use an if/elseif construction to check through a list of various includes, but you can't use a variable name as the include.

You can store the map info in the datbase, code and all (it's just text, after all), and insert THAT instead of using an include. That works too.

So instead of the include you'd use
<%= rs("mapinfo") %>
where you want the map info to show up.
(response.write is too confusing for me... ;-) )
0
 
LVL 19

Expert Comment

by:webwoman
ID: 7028300
Of course, if you're going to pull that info from a database, you need to have a unique number for the record (or some unique identifier) AND you need to pass that to the map page so you know what to pull from the database.

Have you done that before? And did you try changing the map info to a TXT file extension?
0
 

Author Comment

by:balabaster
ID: 7028341
webwoman: yeppers, been there done that...the txt file extension gives me the same aggravation.

With regards to putting the map coordinate info *in* the database, I'd already thought about this, but can't come up with a satisfactory way of putting the info in the database...I don't know if you've seen a coordinate file for a country like the U.S., but it's a mile long.  Putting it into the database is almost as big a headache as trying to get imagemaps in separate files to work.  If this is the only way to do it, then I guess I'm gonna go that route...eek.

Any more ideas would be most welcome.  Why oh why can't software providers implement *anything* on spec?  Anybody working for Microsoft & Netscape.  TAKE HEED TO THAT!

0
 

Author Comment

by:balabaster
ID: 7028529
Well, I guess technically the answer is excellent, although it sucks that this is the only way to do it, so well done.

I've loaded the contents of all my map files into my database and am doing it that way, grrrr.  It works though.

Thanks anyway.
0
 
LVL 19

Expert Comment

by:webwoman
ID: 7028577
I know what you mean... I wish they'd come up with a better way too. I've got entire press releases, with links to pics, tables, tons of HTML code, in my database. It sure would be a whole lot easier if I could just put the include file name there...

Thanks for the A!
0
 

Author Comment

by:balabaster
ID: 7028580
Well you would think that you wouldn't need to load down your database with all that data.  Maybe this hasn't been presented to Microsoft/Netscape yet.

No problems with the (A) I hope ;)

Talk to you again possibly.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now