Thanks a lot. This is the best answer av had so far.
So as far as I understand, when calling for the page, where this javascript will be executed, I'll have to call for the functions again. so that it once again checks all ul li a tags. Thank you so much.