A tray mechanism for accommodating at least one electronic device, wherein the at least one electronic device is mounted in a casing via the tray mechanism, the casing comprises a first side plate and a second side plate opposite to the first side plate, the first side plate has a first holding sheet, and the second side plate has a first block, the tray mechanism comprising: a tray having a bottom plate, a third side plate, and a fourth side plate, wherein the third side plate and the fourth side plate are disposed at two sides of the bottom plate respectively for accommodating the at least one electronic device cooperatively with the bottom plate; characterized by: a fixing plate disposed on the bottom plate; a sheet slidably disposed on the fixing plate; a pin disposed on the sheet, wherein the pin is configured to move upward and downward between a lock position and a release position relative to the fixing plate; a first lock rod disposed on the fixing plate in an obliquely slidable manner, wherein the first lock rod has a first abutting end configured to abut against the first holding sheet and a first slot end, the first abutting end protrudes from the third side plate, and the pin is disposed through the first slot end; and a first push rod disposed on the fixing plate in a transversely slidable manner, wherein the first push rod has a first hook end and a first protruding-block end configured to be biased by the first block, a first inclined-surface structure and a first hook are formed on the first hook end, the first hook extends from the first inclined-surface structure to releasably hook the pin, and the first protruding-block end protrudes from the fourth side plate; wherein when the first block biases the first protruding-block end to retract the first push rod inwardly relative to the fourth side plate to separate the first hook from the pin, the first inclined-surface structure pushes the pin upward to the release position for driving the first lock rod to slide obliquely via the first slot end, to retract the first abutting end inwardly relative to the third side plate to be separate from the first holding sheet. a tray having a bottom plate, a third side plate, and a fourth side plate, wherein the third side plate and the fourth side plate are disposed at two sides of the bottom plate respectively for accommodating the at least one electronic device cooperatively with the bottom plate; characterized by: a fixing plate disposed on the bottom plate; a sheet slidably disposed on the fixing plate; a pin disposed on the sheet, wherein the pin is configured to move upward and downward between a lock position and a release position relative to the fixing plate; a first lock rod disposed on the fixing plate in an obliquely slidable manner, wherein the first lock rod has a first abutting end configured to abut against the first holding sheet and a first slot end, the first abutting end protrudes from the third side plate, and the pin is disposed through the first slot end; and a first push rod disposed on the fixing plate in a transversely slidable manner, wherein the first push rod has a first hook end and a first protruding-block end configured to be biased by the first block, a first inclined-surface structure and a first hook are formed on the first hook end, the first hook extends from the first inclined-surface structure to releasably hook the pin, and the first protruding-block end protrudes from the fourth side plate; wherein when the first block biases the first protruding-block end to retract the first push rod inwardly relative to the fourth side plate to separate the first hook from the pin, the first inclined-surface structure pushes the pin upward to the release position for driving the first lock rod to slide obliquely via the first slot end, to retract the first abutting end inwardly relative to the third side plate to be separate from the first holding sheet. a fixing plate disposed on the bottom plate; a sheet slidably disposed on the fixing plate; a pin disposed on the sheet, wherein the pin is configured to move upward and downward between a lock position and a release position relative to the fixing plate; a first lock rod disposed on the fixing plate in an obliquely slidable manner, wherein the first lock rod has a first abutting end configured to abut against the first holding sheet and a first slot end, the first abutting end protrudes from the third side plate, and the pin is disposed through the first slot end; and a first push rod disposed on the fixing plate in a transversely slidable manner, wherein the first push rod has a first hook end and a first protruding-block end configured to be biased by the first block, a first inclined-surface structure and a first hook are formed on the first hook end, the first hook extends from the first inclined-surface structure to releasably hook the pin, and the first protruding-block end protrudes from the fourth side plate; wherein when the first block biases the first protruding-block end to retract the first push rod inwardly relative to the fourth side plate to separate the first hook from the pin, the first inclined-surface structure pushes the pin upward to the release position for driving the first lock rod to slide obliquely via the first slot end, to retract the first abutting end inwardly relative to the third side plate to be separate from the first holding sheet.