I
Ian Skinner
Hopefully this is an easy one, but I'm not sure how to describe it
concise enough to Google.
I have the following bit of JavaScript:
node.childNodes[0].onclick=function()
{
showHideAllDivs
(
navRoot.parentNode.id,
this.innerHTML.replace(/[^A-Za-z]/g,""),
this.id
);
return false;
} [white space modified for e-mail]
This dynamically assigns a function call to the onClick event of
several anchor tags for some DHTML shenanigans.
The trouble is that the first parameter of the showHideAllDivs()
function needs to be the value of navRoot.parentNode.id at the time of
this assignment (navRoot is initialized before this code), but instead
the event is being created with the navRoot.parentNode.id value
un-resolved and it is being resolved at runtime when the anchors are
clicked on. Unfortunately it is then the wrong value and I get errors
that I spent a very long time tracking down to this cause.
There has got to be a way to write this to say use the value of
navRoot.parentNode.id right now, not wait until later to resolve the
value?
TIA
--------------
Ian Skinner
Web Programmer
BloodSource
www.BloodSource.org
Sacramento, CA
"C code. C code run. Run code run. Please!"
- Cynthia Dunning
concise enough to Google.
I have the following bit of JavaScript:
node.childNodes[0].onclick=function()
{
showHideAllDivs
(
navRoot.parentNode.id,
this.innerHTML.replace(/[^A-Za-z]/g,""),
this.id
);
return false;
} [white space modified for e-mail]
This dynamically assigns a function call to the onClick event of
several anchor tags for some DHTML shenanigans.
The trouble is that the first parameter of the showHideAllDivs()
function needs to be the value of navRoot.parentNode.id at the time of
this assignment (navRoot is initialized before this code), but instead
the event is being created with the navRoot.parentNode.id value
un-resolved and it is being resolved at runtime when the anchors are
clicked on. Unfortunately it is then the wrong value and I get errors
that I spent a very long time tracking down to this cause.
There has got to be a way to write this to say use the value of
navRoot.parentNode.id right now, not wait until later to resolve the
value?
TIA
--------------
Ian Skinner
Web Programmer
BloodSource
www.BloodSource.org
Sacramento, CA
"C code. C code run. Run code run. Please!"
- Cynthia Dunning