First of all, please ensure the ‘Cross-frame support’ option is enabled at the Tools > Compile Properties window.

So when you compile the menu, you will be asked to provide html pages to link both files: the menu.js and the menu_sub.js.