Spray some fabric freshener on your mattress to get any smell and bad odors out. This may be all you need so you won't need to clean your mattress any further.
If your mattress has a cover, take this off and follow the washing instructions sewn into the cover. Most likely, you will need wash it in cold water with a mild detergent and either tumble dry low or air dry. Do not wash plastic mattress covers in the washing machine as this may cause them to tear.
Using a regular vacuum with a hand attachment or a hand-held vacuum, thoroughly vacuum the dust and particles from both sides of your foam mattress.
Use hydrogen peroxide. This process will discolor your mattress. Put some hydrogen peroxide onto a rag and dab in a circular motion onto your soiled area. Repeat the process with water to rinse. Do not soak your mattress. Let it dry for at least 24 hours.
Use borax. You can buy borax in the laundry isle. Spray your soiled area or the whole mattress if you want with plain water. Then gently sprinkle some borax on top. Use a clean cloth or towel to rub gently in circular motions to clean. Blot it dry and then vacuum up all the particles left behind. Again, do not soak your mattress. Let it dry for at least 24 hours.
Use enzymatic pet stain remover for urine stains. Spray your soiled area with enzymatic pet stain remover available in stores where pet supplies are available for purchase. This will get rid of the bacteria and smell caused from urine. Let it sit for at least 30 minutes. If this is a deep urine stain, you may want to use more enzymatic pet stain remover, and then you will need to blot it out with a towel and let it dry for a few days. Know that manufactures will say not to soak your foam mattress at all, even for urine stains.