Add JavaScript function handling