You need to use an event listener, instead of using onkeyup.


On 11/7/2011 11:26 AM, Emperor wrote:
I made a code that shoud show a textbox and a search button, when
pressed, the button it should open a url (http://www.warofninja.com/
profile/) and add the text in textbox to the end of the url, that way:

Url: http://www.warofninja.com/profile/
Text: test
open page: http://www.warofninja.com/profile/test

I'm getting this error

Component is not available
Line: 25 -        input.onkeyup = function(){

My complete code is:

http://pastebin.com/m6aWFz6H

OR

     var elmSearchDiv = document.createElement('div');
     elmSearchDiv.innerHTML =
         '<form method="GET" id ="formulario" action="http://
www.warofninja.com/profile/">' +
         '<label for="player">Digite o nome:</label>  ' +
         '<input type="text" id="player">  ' +
         '<input type="submit" value="Search">' +
         '</form>';
     document.body.insertBefore(elmSearchDiv,
document.body.firstChild);
     elmSearchDiv.style.fontSize = 'small';
     elmSearchDiv.style.textAlign = 'right';
     elmSearchDiv.style.borderBottom = '1px solid silver';

         var form = document.getElementById('formulario'); //dê um id
qualquer para o seu formulário
         var defaultAction = form.getAttribute('action');

         var input = documente.getElementById('player');
         input.onkeyup = function(){
                         form.setAttribute('action', defaultAction +
this.value);
         }

Thanks everyone



--
You received this message because you are subscribed to the Google Groups 
"greasemonkey-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/greasemonkey-users?hl=en.

Reply via email to