If you manage to reassemble it all perfectly, and don't damage anything, then your warranty will likely remain.
But, there are two considerations that you must think of:
1) You must dismantle almost the entire machine. Screen and many internal parts. And, you must open it without snapping one of the plastic clips that keeps it closed. Although some have said that there may be a separate access panel in the rear to remove just the hard drive - but there seems to be a bit of debate there. So, unless you can confirm that you can remove the hard drive without dismantling the entire computer on the 24-inch, then be prepared to do it like the 17 and 20-inch models. On those, you must use a card to release some clips, remove one screw (which I seem to remember hearing is hidden in the RAM slot access panel), and then remove the cover, the LCD screen, the various controller boards in there, and then the hard drive.
2) Assuming that you do replace the drive successfully, understand that any issue that arises later could be potentially blamed on your having disassembled and then reassembled the computer. They can claim that you damaged something, and proving otherwise is pretty hard.
If there is indeed a separate access panel on the 24-inch model, then that may make things much less risky. But, if not, I would only entertain the task if you really like adventure.