Results 1 to 6 of 6

Thread: Help Integrating a Javascript with Image Map

  1. #1
    Join Date
    Dec 2005
    Posts
    107
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Red face Help Integrating a Javascript with Image Map

    Hi there all!

    I am hoping someone can lend a helping hand on something.

    We are using a javascript that when you click the thumbnail, you get a larger picture of it. When the large picture appears we want it to have 2 'areas' that link to separate pages. We don't know how to integrate the javascript with the image map html.

    Here is the javascript:
    ========
    <a href="javascript:doPic('Lanitech_Artwork/ba-gallery2.jpg');">
    <img src="Lanitech_Artwork/ba-gallery2.jpg" width=55 height=72 border=0></a>
    ==========

    Here is the html:
    =========
    <map name="FPMap2">
    <area target="_blank" href="ba-gallery2_small.htm" shape="rect" coords="211, 4, 358, 126">
    <area target="_blank" coords="11, 7, 204, 6, 205, 138, 358, 140, 353, 483, 4, 483" shape="polygon" href="ba-gallery2_small.htm">
    </map>
    <img name="mainpic" src="Lanitech_Artwork/ba-gallery2.jpg" border=0 width="359" height="488" usemap="#FPMap2">
    ===========

    Here is what we wrote that doesn't work (every time we save it in Frontpage the map script disappears all by itself!):
    ==========
    <map name="FPMap1">
    <a href="javascript:doPic('Lanitech_Artwork/ba-gallery2.jpg',usemap='#FPMap1');">
    <area target="_blank" href="ba-gallery2_small.htm" shape="rect" coords="211, 4, 358, 126">
    <area target="_blank" coords="11, 7, 204, 6, 205, 138, 358, 140, 353, 483, 4, 483" shape="polygon" href="ba-gallery2_small.htm">
    </map>
    <img src="Lanitech_Artwork/ba-gallery2.jpg" width=55 height=72 border=0></a>

    =========
    Please help us write this correctly, anyone PLEASE!!

  2. #2
    Join Date
    Oct 2008
    Location
    Sweden
    Posts
    2,023
    Thanks
    17
    Thanked 319 Times in 318 Posts
    Blog Entries
    3

    Default

    I don't know what javascript code you are using so I don't know if the link should be around the image map or the image, but the way you have it now is wrong. Your first open the map, then the link, but you close the map first and the link last:
    HTML Code:
    <map name="FPMap1">
    <a href="javascript:doPic('Lanitech_Artwork/ba-gallery2.jpg',usemap='#FPMap1');">
    <area target="_blank" href="ba-gallery2_small.htm" shape="rect" coords="211, 4, 358, 126">
    <area target="_blank" coords="11, 7, 204, 6, 205, 138, 358, 140, 353, 483, 4, 483" shape="polygon" href="ba-gallery2_small.htm">
    </map>
    <img src="Lanitech_Artwork/ba-gallery2.jpg" width=55 height=72 border=0></a>
    Your code should look like one of the following two:
    HTML Code:
    <a href="javascript:doPic('Lanitech_Artwork/ba-gallery2.jpg',usemap='#FPMap1');">
    <map name="FPMap1">
      <area target="_blank" href="ba-gallery2_small.htm" shape="rect" coords="211, 4, 358, 126">
      <area target="_blank" coords="11, 7, 204, 6, 205, 138, 358, 140, 353, 483, 4, 483" shape="polygon" href="ba-gallery2_small.htm">
    </map>
    <img src="Lanitech_Artwork/ba-gallery2.jpg" width=55 height=72 border=0></a>
    or
    HTML Code:
    <map name="FPMap1">
      <area target="_blank" href="ba-gallery2_small.htm" shape="rect" coords="211, 4, 358, 126">
      <area target="_blank" coords="11, 7, 204, 6, 205, 138, 358, 140, 353, 483, 4, 483" shape="polygon" href="ba-gallery2_small.htm">
    </map>
    <a href="javascript:doPic('Lanitech_Artwork/ba-gallery2.jpg',usemap='#FPMap1');"><img src="Lanitech_Artwork/ba-gallery2.jpg" width=55 height=72 border=0></a>
    I'm guessing it's the second one.

    Edit: To be more specific:
    This is invalid: <aaa><bb> </aaa></bb>
    This is valid: <aaa><bb> </bb></aaa>
    Last edited by Snookerman; 12-08-2008 at 09:07 PM.

  3. #3
    Join Date
    Dec 2005
    Posts
    107
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    We will try both and see what happens! Thank you so much.

  4. #4
    Join Date
    Oct 2008
    Location
    Sweden
    Posts
    2,023
    Thanks
    17
    Thanked 319 Times in 318 Posts
    Blog Entries
    3

    Default

    You're welcome and good luck!

  5. #5
    Join Date
    Dec 2008
    Location
    Nigeria
    Posts
    95
    Thanks
    3
    Thanked 8 Times in 8 Posts

    Default

    Alternatively, u can use the innerHTML property to render both the map and the image at the same using what frontpage generate, if your present options do nt work, post to me so i can write out a sample code.

  6. #6
    Join Date
    Dec 2008
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Check this


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •