'How do I show Popup Message everytime I go to another Sheet using Google Sheet/Apps Script? [duplicate]

I have 3 sheets in a workbook - Sheet1, Sheet2, and Sheet3, every time I change to a Sheet there is a Popup message that will show up.

What I had in mind...

  function onOpen() {
      var ui = SpreadsheetApp.getUi();
      ui.alert('This is my pop up message!');
  }


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source