I needed to automate a few tasks in a browser and ran across a Firefox plug-in from MIT. The source to this plug-in is a combination of JavaScript, Java and AJAX.
Chickenfoot is a Firefox extension that puts a programming environment in the browser's sidebar so you can write scripts to manipulate web pages and automate web browsing. In Chickenfoot, scripts are written in a superset of Javascript that includes special functions specific to web tasks.
Running this chickenfoot script on google.com will replace the google logo with the ninja.png image.
replace('Google image',
'<img src="http://www.bolinfest.com/ninja.png">')
Chickenfoot Website