A method for direct measuring the magnetostriction of ferromagnetic films (deposited on nonmagnetic substrates) in using an atomic force microscope was suggested. In measuring the magnetostriction for films 10 [mm] in length and 0,2 [μm] in thickness, which were deposited on substrates 200 [μm] thick, the minimum measured magnetostriction magnitude is ~10-7. The procedure was tested for Ni and Fe films. The magnetostriction magnitudes measured for the films are comparable with those obtained by other magnetostriction-measuring methods. The effect of alloying with zirconium and nitrogen on the magnetostriction of nanocrystalline Fe films was studied.