jh*****@yahoo.com wrote:
I am doing some maintenance on a js tree control that was done with
proprietary IE code.
When I click on a node it calls a function which has code similar to
that below to expand the tree. "el" refers to the div that I clicked
on.
var workHtml = el.innerHTML;
for (i = 0; i < idx; i++)
{
strHtml = '<div><span onclick=f_Click("'+ idx +
'")></span></div>';
workHtml = strHtml + workHtml;
}
el.innerHTML = workHtml;
Now, this works, both in IE and FireFox, but in FireFox I get the
"Waiting..."
message in the status bar at the bottom of the frame.
Is there something more I should add?
I am guessing but a message in the status bar is not likely to be caused
by some innerHTML change, perhaps you are calling that code from a link e.g.
<a href="javascript: functionName()">
or
<a href="#"
onclick="functionName();">
and the problem goes away with
<a href="#"
onclick="functionName(); return false;">
Or should I have used another
approach rather than innerHTML?
If you want to add elements to the el element then you can use the W3C
DOM e.g.
var div, span;
if (document.createElement && (div = document.createElement('div'))) {
span = document.createElement('span');
span.onclick = function (evt) { f_Click(idx); };
// maybe you need
// span.onclick = new Function ("evt", "f_Click('" + idx + "');");
// instead, I am not sure what idx is in your snippet
span.appendChild(document.createTextNode('span content'));
div.appendChild(span);
el.appendChild(div);
}
--
Martin Honnen
http://JavaScript.FAQTs.com/