i have found that using frames is the best way around it, but if you insist on not using frames, then you could place a hidden html tag eg.
at the point where you want your returned code to appear, create a cript that opens your html file (as a template) and reads it into an array, do a foreach loop through the array and if is found on the line, run the required routine then finnish your foreach loop... I hope that makes sense