Posted under » JavaScript on 5 December 2010
One of the easiest method to practice Javascript is to write a tampermonkey or greasemonkey script.
A simple autologin script for tampermonkey
// ==UserScript==
// @name auto login to mysqladmin
// @namespace anoneh
// @version 0.1
// @description tired of login
// @author Hanafi
// @include http://www.drupalsite.com/
// ==/UserScript==
(function() {
'use strict';
var name = "root"
var pass = "4444666666"
document.getElementById('input_username').value = name
document.getElementById('input_password').value = pass
})();
You will notice the use strict thingie.
It is there for a reason. Use it and don't get put off by it.
However, not all forms has id but have name only. In this case.
var zTextFields = document.getElementsByTagName("input");
for (var i=0; i < zTextFields.length; i++) {
var thefield;
thefield=zTextFields[i].name;
if (!thefield) thefield=zTextFields[i].id;
// Set up your auto-fill values here
if (thefield == "username") zTextFields[i].value="bradpitt";
if (thefield == "password") zTextFields[i].value="jolie";
// alert("field:" + thefield + " value: " + zTextFields[i].value);
}