I am parsing some elements of an HTML document to add onmouseover and
onmouseout actions to them dynamically. However, if they already have
actions, I want to include them those as well...
I can get the code inside the applied mouseover function with something
like:
if(typeof(obj.o nmouseover)=='f unction'){
// make the function definition a string.
funcOverDefn = "" + obj.onmouseover ;
// find the positions of the openeing and closing
// curly braces
firstBrace = funcOverDefn.in dexOf('{');
lastBrace = funcOverDefn.la stIndexOf('}');
// get everything between the braces
funcOverDefn=fu ncOverDefn.subs tring(firstBrac e+1,lastBrace);
}
Then if the element needs something applied (for instance, changing the
display style), I use:
obj.onmouseover =function(){
// display the child element
this.lastChild. style.display=" block";
}
However, I want to also apply the code found in the previously found
funcOverDefn variable. Can this be accomplished?
Any pointers/references greatly appreciated.
TIA
--
Justin Koivisto - justin@koivi.co m
onmouseout actions to them dynamically. However, if they already have
actions, I want to include them those as well...
I can get the code inside the applied mouseover function with something
like:
if(typeof(obj.o nmouseover)=='f unction'){
// make the function definition a string.
funcOverDefn = "" + obj.onmouseover ;
// find the positions of the openeing and closing
// curly braces
firstBrace = funcOverDefn.in dexOf('{');
lastBrace = funcOverDefn.la stIndexOf('}');
// get everything between the braces
funcOverDefn=fu ncOverDefn.subs tring(firstBrac e+1,lastBrace);
}
Then if the element needs something applied (for instance, changing the
display style), I use:
obj.onmouseover =function(){
// display the child element
this.lastChild. style.display=" block";
}
However, I want to also apply the code found in the previously found
funcOverDefn variable. Can this be accomplished?
Any pointers/references greatly appreciated.
TIA
--
Justin Koivisto - justin@koivi.co m
Comment