[IMP]replace the js code with template