How can I use one javascript file to deal with all the Html pages on the site? without problem [closed]

How can I use one javascript file to deal with all the Html pages on the site? Because I have a problem that the elements that I deal with in one of the pages are not found on the other pages