1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Function not defined error

Discussion in 'JavaScript' started by Arnold9000, Feb 11, 2007.

  1. #1
    I get a function not defined error in my firefox javascript console and I can't figure out why. Here's the javascript

    <script src="findDOM.js"></script>
    <script language="javascript">

    var hideit="true";
    var hideit2="true";

    function swap_visibility(objID, cellid){
    alert("not working");
    var domcell = findDOM(cellid, 1);
    domcell.className = "navbright";
    alert("line 3");
    var domobj = findDOM(objID, 1);
    domobj.visibility = "visible";


    }

    function reset_visible(objID, cellid){
    var domcell = findDOM(cellid, 1);
    domcell.className='nav';
    var dom = findDOM(objID, 1);
    if (hideit == "true"){
    dom.visibility = "hidden";
    hideit = "true";
    )
    }

    </script>


    Here's the calling HTML

    <td class="nav" id="ddcell" onMouseover="swap_visibility('DrunkDriving', 'ddcell'); return true;" onMouseout="reset_visible('DrunkDriving', 'ddcell'); return true;">DrunkDriving</td>

    Pretty simple right? So why doesn't it think that neither "swap_visibility" nor "reset_visible" are not found? I must be blind. Thanks in advance.
     
    Arnold9000, Feb 11, 2007 IP
  2. MattD

    MattD Peon

    Messages:
    161
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Have you put all of this code in the <head>?
     
    MattD, Feb 11, 2007 IP
  3. Arnold9000

    Arnold9000 Peon

    Messages:
    241
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Yes, good thought. But what you see is in the head tag (obviously aside from the calling html). I'm really stumped, and it's going to end up being something stupid :)
     
    Arnold9000, Feb 11, 2007 IP
  4. phper

    phper Active Member

    Messages:
    247
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    60
    #4
    Is there any more error messages above that? If the function is there but the error message says otherwise, most probably there is a syntax error somewhere which causes the function definition not loaded by the JS engine.
     
    phper, Feb 11, 2007 IP
  5. Arnold9000

    Arnold9000 Peon

    Messages:
    241
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #5
    The Javascript console only gives me what I mentioned. It's gotta' be something really stupid where a second pair of eyes will catch it
     
    Arnold9000, Feb 11, 2007 IP
  6. webisfun

    webisfun Peon

    Messages:
    57
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #6
    well, you were right on something ... it was really stupid,

    it's a )
    instead of a }

    that closes the if { of your last function (see the line before the last } )

    Have a nice day
     
    webisfun, Feb 11, 2007 IP
  7. Arnold9000

    Arnold9000 Peon

    Messages:
    241
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Yep, that was it. Thanks. I knew a second pair of eyes would find it.
     
    Arnold9000, Feb 15, 2007 IP