As you would with any other genre, you should read lots of cartoons and comic strips before attempting to write one. Study what kinds of jokes they make, what kinds of characters are used, even how many panels are drawn. You will need to decide for yourself whether you're going to make a single panel cartoon or a strip of three or four (or more) panels.
For an example of a student-written cartoon, see this one by Taylor.
Check out the following web sites for cartoons and cartooning advice: