I doubt this is the industry's rule, but the approach I've taken with PHP and Java with the MVC concept is this: All HTML goes in a template, whenever possible. All server-side code stays in [language of choice]. I say "whenever possible" because there's times when I need to show an error message and its just easier to drop in the break tag when you need to force a new line. There's some file naming and class conventions I'll use, but that's pretty minor.
I almost always put the JavaScript within the HTML. If its small then I put it directly in, if its large then I put it in its own .js file and have the HTML call it. My template system has ways I can drop and sprinkle variables in where ever I need them. This works out great for handling tough jobs like table rows and JavaScript references to custom stuff. If need be, I'll generate the JavaScript with [language of choice] and drop it in as a template variable. Sort of extreme, but definitely an option and I've done it before.