With the development of modern science and technology, the elements such as Al, Si, Mo, C, B will be doped into the TiN and CrN binary films to improve their properties. In this work, a series of Ti-X-N and Cr-X-N films were prepared under the various N2 partial pressures，bias voltages and substrate temperatures by reactive magnetron sputtering using the mosaic target and multi-targets systems. The composition, microstructure, mechanical properties and thermal stability of the films were investigated using EDS, XRD, XPS, AFM, nano-indentation, scratch and thermal stability test. The results indicated that the doping element content, microstructure and mechanical properties of the films can be easily regulated through the deposition parameters, such as the N2 partial pressure，bias voltages and so on. The superhard Ti-Si-N and Ti-Al-N films with the nanohardness of more than 40GPa can be achieved, especially when the lower N2 partial pressure is used.