<a href="term_1.html" onClick="alert('A caldera is a circular shaped
landform depression caused by the eruption of a large, near surface
body of magma.'); return false">caldera</a>
我尝试运行此块,但是它不起作用。当我在
alert
中写其他消息时(除了),它工作正常。谁能告诉我确切的问题是什么? 最佳答案
您的字符串将换行,从而导致onclick
处理程序中断。尝试这个:
<a href="term_1.html" onclick="alert('A caldera is a circular shaped landform depression caused by the eruption of a large, near surface body of magma.'); return false">caldera</a>
演示:http://jsfiddle.net/Q9gbV/1/