SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Oct 2006
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    javascript newbie "is not a function?"

    Hi,

    I'm trying to set up a rollover on an image map so that the image changes on mouse over.

    I keep getting "libcat is not a function" in the firefox javascript debugger.

    Honestly I don't use javascript that often so I may have made pretty simple mistake.

    here's this part of the javascript...

    HTML Code:
    <script type="text/javascript">
    function libcat(img_ovr) {
    document.getElementById(img_ovr).src = "libcat.gif";
    }
    </script>
    here's the html...

    [HTML]<div id="wrapper">
    <img alt="leftcolumn" src="colleft.gif" height="444px" width="117px" id="leftone" />
    <img alt="centerleft" src="left.gif" height="444px" width="262px" id="lefttwo" usemap="#leftmap" />

    <map id ="leftmap" name="leftmap">
    <area shape ="poly" coords ="141,76,174,124,218,166,232,165,253,156,254,107,252,54,192,56"
    onMouseOver="libcat('lefttwo')"
    href ="_insert_here_" alt="library catalogue" />

    </map>
    </div>

    Any ideas what I'm doing wrong?

    Thanks

  2. #2
    SitePoint Addict darkwater23's Avatar
    Join Date
    Nov 2005
    Location
    Omaha, NE
    Posts
    335
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I replicated your code the best I could and didn't get the same error. Is your function in an external JS file? If so, there may be a problem with the include. Otherwise, nothing pops out at me. Sorry!


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
  •