Mortier Posted June 14, 2007 Share Posted June 14, 2007 Hello all, I have an very odd error in my code: function open_one(all_element, one_element, event_div) { alert(event_div) } <body onload="load_config(document.getElementById('all_items'), document.getElementById('one_item'), 'collapse'); return false"> <img id="collapse" src="img/img_left.png" onclick="open_one(document.getElementById('all_items'), document.getElementById('one_item'), 'collapse'); return false" alt="Uitklappen" /> <div id="all_items">Alle items</div> <div id="one_item">Één item</div> </body> The problem is that the alert (which I use for debugging) returns 'undefined'. While I give it the value 'collapse' in the function call. I tried everything but I don't know why it does not work. Tested in Firefox. Quote Link to comment Share on other sites More sharing options...
nogray Posted June 14, 2007 Share Posted June 14, 2007 The open_one() function works fine, you have an load_config() function on the onload, maybe it's causing the error. Quote Link to comment Share on other sites More sharing options...
Mortier Posted June 14, 2007 Author Share Posted June 14, 2007 Oh damn you are right I now realize that the function was called from there and not from the image onClick event.. ai ai ai. Well thanks for your help, I'm glad it works Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.