Link to home
Start Free TrialLog in
Avatar of voletisri
voletisri

asked on

Using ClientSide ImageMaps in HTML.


I have a map which is clickable and their co-ordinates are defined in the same HTML file i.e.
<HTML>
<HEAD>
</HEAD>

<BODY>
<IMG src="sonic.gif" width=500 height=600 usemap="#map1" border="0">

<MAP NAME="map1">
<area shape="rect" alt="Access Guide" coords="0,0,10,20" href="guide.html">
<area shape="rect" alt="Search" coords="2,4,15,30" href="search.html">
<area shape="rect" alt="Four" coords="10,50,1000,1000" href="four.html">
<area shape="rect" alt="Icim Company" coords="23,11,188,87" href="http://www.icil.com">
<area shape="rect" alt="Deccan Paper" coords="66,36,159,68" href="http://www.deccan.com/">
</MAP>
</BODY>
</HTML>

My question is can I seperate the map file and keep it in a different HTML file and call from the
main HTML file i.e

1.html will look like this

<HTML>
<HEAD>
</HEAD>
<BODY>
<IMG src="sonic.gif" width=500 height=600 usemap="2.html#map1" border="0">
</BODY>
</HTML>
my 2.html will look like this
<HTML>
<HEAD>
</HEAD>
<BODY>
<MAP NAME="map1">
<area shape="rect" alt="Access Guide" coords="0,0,10,20" href="guide.html">
<area shape="rect" alt="Search" coords="2,4,15,30" href="search.html">
<area shape="rect" alt="Four" coords="10,50,1000,1000" href="four.html">
<area shape="rect" alt="Icim Company" coords="23,11,188,87" href="http://www.icil.com">
<area shape="rect" alt="Deccan Paper" coords="66,36,159,68" href="http://www.deccan.com/">
</MAP>
</BODY>
</HTML>

I am trying out this and I could not get it working. So, first of all I would really like to know that,
whether we can separate map definition file from main HTML file.

Really would appreciate UR help as we are need this info. very urgently.
Thanks.
Avatar of johnny99
johnny99

That should work -- try putting the full URL, like this:

http://www.yourcompany.com/2.html#map1

That might do it. Good luck. I'll come back and post again after I've checked something.
Avatar of voletisri

ASKER


I have tried giving the complete URL.But it still doesnot work.The browser versions I am using are Internet Explorer 4.0 and Netscape 4.0.Do the above browsers support my problem or not,I am not able to understand.Please if somebody could help me out in solving this problem,I would appreciate.

Thanks
Avatar of sybe
I suppose you want this because you want to use the same map in several html-files. The you can use SSI to include seperate textfiles into a html:

<!--#INCLUDE FILE="map1.txt"-->

You can just use plain text for the map-code, so no <HTML> and <BODY> tags.

But if you want to do this because you want to code to be invisible to the browser, then there is no way to do it, because it is CLIENT side, so it has to be read by the browser.



I donot want to use any server side includes.The project which I am doing has such requirement.Different HtmlS WILL BE using the same map file.That is why I want to seperate it.
Is there any way out? Please help.

Thanks
ASKER CERTIFIED SOLUTION
Avatar of sybe
sybe

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi, Violetisri

I have tried it, and it doesn't work on my server either: you were quite right to reject my answer.

To all the people telling you to use SSI etc, answer me this -- why do several sources of documentation tell me this /does/ work?

I'm completely bemused and I'm going to ask in a newsgroup...

Hope you're holding the fort!

If you're depearate for a solution to a large site which has a number of imagemaps, can't you use a fully-featured text editor to do a big Search and Replace on all your documents to put the imagemap <MAP> stuff in? That's my workaround anyway.
OK here's what I've learned having a look around in newsgroups: external client-side image maps *are* in the HTML 3 spec, but are not implemented in either browser.

It can't be done.

Tell us your situation, and we'll have to come up with another answer.
Hai Johnny,sybe

Thank you very much for your help.After going thru' some documents I too found out that external client side imagemap files are not supported by either IE or Netscape.I got another solution for this.Actually my project uses NetDynamics tool to build the application.What I could do is before loading the page I read the file into Java String and add it to the HTML on the fly.This solves my problem.
        I was under the opinion that if external Client side Image map files could be implemented as given in the HTML Tutorials,it would be more efficient.That's why I was trying for it.

Finally,Thank you very much again.

Regards,
Srinivas