Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New to the CF scene
    Join Date
    May 2003
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Trouble placing html image map in external JS file

    Hello,

    I have created an html image map that I would like to have appear on multiple Web pages; therefore, I would like to place the html instructions inside document.write commands in a js file. I have had no trouble in the past when it comes to getting external js files to perform using document.write commands; I often use js files to supply a consistent navigation area, for instance; however, I can't seem to make my image map work when I call it up from an external file. (The image map works fine when its coding is on the html page itself.)

    Below is an abbreviated version of the js file I am using so that hopefully someone can tell me what I'm doing wrong. The file name is test.js and the script is "called" in the body section of my html page with the line

    Code:
    <SCRIPT SRC="test.js" TYPE="text/javascript">
    abbreviated version of external file test.js.........

    Code:
    document.write ('<MAP NAME="owlalleyMap4">');
    document.write ('<AREA SHAPE="polygon" COORDS="65,138,94,126,110,161,115,187,82,185,80,204,67,202" HREF="mailto:quass@quass.com" TITLE="E-mail owlmaster Brian">');
    document.write ('<IMG SRC="http://www.quass.com/owlspecies/owlalley.jpg" WIDTH="681" HEIGHT="369" ALIGN="BOTTOM" BORDER="0" USEMAP="#owlalleyMap4">');
    Thanks for any and all help,
    Brian
    Last edited by Remon Jones; 09-21-2005 at 05:54 AM.

  • #2
    Regular Coder
    Join Date
    Aug 2005
    Location
    Toronto, ON, Canada
    Posts
    231
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I assume the js file is large one. Which browser do you use?
    rm -f /

  • #3
    New to the CF scene
    Join Date
    May 2003
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I use Safari 1.3.1 and I.E. 5.2 for Mac, neither of which will display my image map from a js file.

    I've uploaded the functioning html version of the image map to my site at

    http://www.quass.com/example.html

    You're welcome to look at the source code there. I thought transferring the image map coding to a separate js file was just a matter of putting the map and area statements inside document.write(" ") brackets, but that doesn't seem to work.

    Thanks again for your time.

    Brian

  • #4
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Why are you trying to put the image map in a JS file in the first place? You can use a server side include if all you intend to do is write the image map to the page.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #5
    New to the CF scene
    Join Date
    May 2003
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I don't know how to use a server side include and my hosting company provides no assistance for such things.

  • #6
    Regular Coder
    Join Date
    Aug 2005
    Location
    Toronto, ON, Canada
    Posts
    231
    Thanks
    0
    Thanked 0 Times in 0 Posts
    did you try something like:

    test.js
    function drawMap() {
    document.write(...);
    document.write(...);
    document.write(...);
    }

    and in html
    <head>
    <SCRIPT SRC="test.js" TYPE="text/javascript">
    </head>
    <body>
    ...
    <script>
    drawMap();
    </script>
    ...
    </body>
    rm -f /

  • #7
    TNO
    TNO is offline
    Regular Coder
    Join Date
    Apr 2005
    Posts
    213
    Thanks
    2
    Thanked 1 Time in 1 Post

    Internet Explorer

    Probably a stupid question but,

    Why not do this for every page?

    Code:
    <center>
    <iframe src="http://www.quass.com/example.html" style="width:681;height:369;margin:0 0 0 0;" Allowtransparency ="True"></iframe>
    </center>
    Last edited by TNO; 09-24-2005 at 06:05 AM.


  •  

    Posting Permissions

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