Heat butter in small skillet and lightly brown onion.
In ungreased 9x11 baking pan, put a single layer of sliced potatoes. Top with some of the browned onion, then add a layer of ham, then cheese. Continue layering potatoes, onion, ham and cheese until all is gone and you have a layer of cheese on top.
In saucepan, heat milk with spices until hot. Pour over potatoes.
Bake, uncovered, in 400° oven for about 45 mins or until potatoes and most of the milk is absorbed.