[Greasemonkey] Re: modify java script

Prakash Kailasa pk-moz at kailasa.net
Wed Jul 13 09:51:08 EDT 2005


On Wed, Jul 13, 2005 at 06:46:01AM +0530, V V Raja Rao wrote:
> Hi,
> 
> Attached below is the java script function: This function is called
> when this link on the page is clicked:
> 
> <a href="#"  onclick="check(4);return false;" class="zi01">Service Records</a>
> 
> ------------------------------------------------------------------------------
> 
> function check(parameter){
>       .....
>     }

Write your own version of check(), which does what you want, and in
your Greasemonkey script, replace the onclick attribute for the <a>
element with call to your own version.

function my_check(parameter) {
    // do the Right Thing!
    ....
}

// find the element <a> using xpath or any other means
var my_a = ...;

my_a.onclick = function() {my_check(4); return false;}

HTH,
/prakash

-- 
|A successful [software] tool is one that was used to do something     |
|undreamed of by its author.                                           |
|                -- S. C. Johnson                                      |


More information about the Greasemonkey mailing list