Trouble calling a function
Posted: Tue Sep 22, 2009 6:22 pm
Hi,
I have this function in a js file separate from the main file:
And I try to call it from the main file with this button:
I can't get it to work! It works when I use
But I can't use a button to call it for some reason. All of the other functions in the separate file are able to be called by the onclick handler, but this one isn't and I have no clue why.
I have this function in a js file separate from the main file:
Code: Select all
function close(keyid)
{
alert("testing");
document.getElementById(keyid).innerHTML = "";
}
Code: Select all
<a onclick="close(2)">Click</a>
Code: Select all
<body onload="close(2)">