para: string;
return value: No return value;
alert(para);
alert()方法在函数中会优先执行, 例如
<table>
<tr>
<td>one</td>
</tr>
<tr>
<td id="c2">two</td>
</tr>
</table>
<script>
var c2 = document.getElementById('c2');
c2.addEventListener('click', click, false);
function click(evt) {
c2.innerHTML = "hello";
alert('Stop');
}
</script>
点击two 会先弹出 stop 以后点击确定以后 c2 内容 才会变成 hello
再看与alert()相关的例子
window.location = 'http://www.oreilly.com/';
setTimeout(function() { alert('hello world')}, 0);
这样的话也是会先弹出会话框 ‘hello world’, 时间设置大些会先跳转到 oreilly 窗口
para: string;
Return Value: boolean // true or false
confirm(para);
para: string;
Return Value: value // 返回输入的内容
prompt(para);
本文探讨了JavaScript中事件触发的顺序及对话框的应用。通过具体实例解释了alert(), confirm() 和 prompt() 函数的使用场景及它们如何影响页面元素的变化。文章还展示了alert() 方法在事件处理程序中的执行优先级。
37

被折叠的 条评论
为什么被折叠?



