Jump to content

Undefined variable


Mortier

Recommended Posts

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.

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.