We investigated changes of regional activation in the frontal cortices as assessed by changes of hemoglobin oxygenation during walking at 3 and 5 km/h and running at 9 km/h on a treadmill using a near-infrared spectroscopic (NIRS) imaging technique. During the acceleration periods immediately preceded reaching the steady walking or running speed, the levels of oxygenated hemoglobin (oxyHb) increased, but those of deoxygenated hemoglobin (deoxyHb) did not in the frontal cortices. The changes were greater at the higher locomotor speed in the bilateral prefrontal cortex and the premotor cortex, but there were less speed-associated changes in the sensorimotor cortices. The medial prefrontal activation was most prominent during the running task. These results indicate that the prefrontal and premotor cortices are involved in adapting to locomotor speed on the treadmill. These areas might predominantly participate in the control of running rather than walking.