To call the db.transaction() function, one parameter is required. This parameter itself is a function called by db.transaction() , and when it calls this function, it passes one parameter to it. The name tx can be anything, it's just the name for the first parameter of this function.
Your code could be written using this function, which you pass to db.transaction() as an anonymous function, for example, you are here:
db.transaction(function (tx) { tx.executeSql("INSERT INTO WebKitStickyNotes (id, note, timestamp, left, top, zindex) VALUES (?, ?, ?, ?, ?, ?)", [note.id, note.text, note.timestamp, note.left, note.top, note.zIndex]); });
or it could be written in a way where it is a little more obvious what is happening, but not so compact:
function writeSql(tx) { tx.executeSql("INSERT INTO WebKitStickyNotes (id, note, timestamp, left, top, zindex) VALUES (?, ?, ?, ?, ?, ?)", [note.id, note.text, note.timestamp, note.left, note.top, note.zIndex]); } db.transaction(writeSql);