Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <style type="text/css">
- #abc{ boarder:1px solid black; width: 500px; height: 40px;}
- </style>
- <script type="text/javascript">
- function onKeyUpHandler(campo, funcao, tempo,paramentro)
- {
- var searchTimeout;
- campo.onkeyup = function (event)
- {
- var tecla = (window.Event) ? event.which : event.charCode;
- if (typeof searchTimeout != "undefined") clearTimeout(searchTimeout);
- if (typeof paramentro == "undefined") paramentro = "";
- else{var string = new String(paramentro);
- if (string.substr(0,1)!=',') paramentro = ",'"+paramentro+"'"; }
- searchTimeout = setTimeout(funcao+"("+campo.id+","+tecla+paramentro+")", tempo);
- };
- }
- function funcaoteste(nomecampo, teclapress)
- {
- document.getElementById('def').innerHTML += nomecampo+'|'+teclapress+'<br />';
- document.getElementById('def2').innerHTML += nomecampo.value+'<br />';
- }
- function criaInput()
- {
- document.getElementById('abc').innerHTML = '<input type="text" name="idteste" id="idteste" value="" onfocus="if (this.onkeyup==null) onKeyUpHandler(this,\'funcaoteste\',1000);" />';
- }
- </script>
- </head>
- <body>
- <div id="abc"></div>
- <div id="def"></div>
- <div id="def2"></div>
- <div id="ghi">
- <input type="button" value="Novo Input" onclick="criaInput();"/>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement