rendered paste body<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><script> function TempTag(uri){ var tag = document.createElement("script"); var marcador = "variable"+(new Date().getTime())+"="+(new Date().getTime()); tag.src = uri.lastIndexOf("?") > -1 ? uri+"&"+marcador : uri+"?"+marcador; tag.onload=function(){ document.body.removeChild(tag); }; this.carregar=function(){ document.body.appendChild(tag); }; } function $(id){ return document.getElementById(id); } function load(){ var vv = $("vv"); vv.onclick=function(){ new TempTag("haha.jsp").carregar(); } }</script></head><body onload="load()"> <button id="vv">carrega lazy function</button> <button id="zz" onclick="haha()">usa lazy function</button></body></html>