[Greasemonkey] gm addedd javascript would work without it?

chris feldmann cfeldmann at gmail.com
Thu Jun 29 10:02:15 EDT 2006


On 6/29/06, carlos campderrós <gilipollas.desconcertante at gmail.com> wrote:
> On 6/29/06, chris feldmann <cfeldmann at gmail.com> wrote:
> > On 6/28/06, carlos campderrós <gilipollas.desconcertante at gmail.com> wrote:
> > > I'd like to add a form on a web with an input text, a select combo box
> > > and a button. depending on the value of the select the result will be
> > > different, so I need javascript for this to work. If javascript is
> > > disabled, will my form work? Is there anyway to see if the user has
> > > javascript disabled to not put the form in the page?
> >
> > Sure, you can. You can put forms with as many inputs as you want all
> > over the web with greasemonkey. What you can't do is put the code
> > needed to accept and process those inputs on the webservers behind the
> >  webpages, which makes the exercise rather pointless.
>
> I don't know if I hadn't been understood, I'm wrong with GM or I don't
> understand you. I can define js functions and add them to whatever
> element I will, and keep that function working when the user clicks or
> does something. I'm right? I really don't know how to do it, but I
> think it's in the dive into gm book, so this is not a problem.
>
> This will be my js generated form:
> <form name="foo" action="useless.html" type="get">
> <input type="text" name="id" id="id"/>
> <select name="what" id="what">
>   <option value="player">player</option>
>   <option value="team">team</option>
>   <option value="match">match</option>
> </select>
> <input type="button" onclick="myGMAddedFunction()" />
> </form>
>
> and the myGMAddedFunction would be something like this:
>
> function myGMAddedFunction()
> {
>   var in = document.getElementById('id').value;
>   var sel = document.getElementById('sel').selectedValue;
>   if (sel == 'player')
>   {
>     window.location = 'players.asp?playerID='+in;
>   } else if (sel == 'team') {
>     window.location = 'team.asp?teamID='+in;
>   } else if (sel == 'match') {
>     window.location = 'match.asp?matchID='+in;
>   }
> }
>
> I think this could be done,


I agree.  I stand totally corrected.


More information about the Greasemonkey mailing list