Temperature is essential for the survival and development of eggs. Some anurans have evolved and developed foam nesting traits, with thermal insulation considered to be among their functions. Foam-nesting frogs tend to exhibit reproductive plasticity. For example, they oviposit on both trees and the ground. How such plasticity affects foam nest function is of major relevance and is likely related to the adaptation of foam nesting frogs. However, this has not been well studied. In this study, we examined the interaction between foam nest site, foam nest function, and egg fate using the Japanese green tree frog, Zhangixalus arboreus, and analysed how nest site differences (arboreal or terrestrial) affect the thermal function of foam nests. We compared the thermal functions of foam nests between arboreal and terrestrial oviposition sites of Z. arboreus. We artificially replaced half of the arboreal nests with terrestrial environments and recorded temperature in and outside of the experimental terrestrial nest and original arboreal nests. We also examined egg survival and hatching rates for all the nests. The results indicated superior heat insulation in terrestrial nests, with warmer temperatures inside than outside the nests, especially at night, which led to a high egg survival rate. Therefore, terrestrial ovipositing should be valid under cold weather conditions. This may be related to the evolutionary history of oviposition site plasticity of this genus, which originally had an arboreal oviposition trait but evolved into terrestrial site use owing to global cooling. Our novel insights into the evolution and adaptivity of foam nesting and oviposition site use in Z. arboreus make an important contribution to animal ecology.