Following code snippet will update record on button click on any standard detail page

  1. Create a new button from Object Name -> Button and links with following code.

{!REQUIRESCRIPT("/soap/ajax/30.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/30.0/apex.js")}

var myquery = "SELECT Id,Name FROM Account WHERE Name = 'aaa' limit 1";

result = sforce.connection.query(myquery);
records = result.getArray("records");

var myObj;
if(records[0]){
myObj = records[0];
}

alert(myObj.Name);
myObj.Name = 'Hello';

var results = sforce.connection.update([myObj]);

alert('Successfully updated.');

  1. Add button to page layout.

UPDATE RECORD USING JAVASCRIPT