We present a method for dynamically measuring the refractive index distribution in a large range based on the combination of digital holographic interferometry and total internal reflection. A series of holograms, carrying the index information of mixed liquids adhered on a total reflection prism surface, are recorded with CCD during the diffusion process. Phase shift differences of the reflected light are reconstructed exploiting the principle of double-exposure holographic interferometry. According to the relationship between the reflection phase shift difference and the liquid index, two dimensional index distributions can be directly figured out, assuming that the index of air near the prism surface is constant. The proposed method can also be applied to measure the index of solid media and monitor the index variation during some chemical reaction processes.