confirm('确定要定餐?')

来源:百度知道 编辑:UC知道 时间:2024/06/10 09:01:54
confirm('确定要定餐?')
confirm('确定要定餐'+document.form.orderNum.value+'份?')

onclick="return confirm('确定要定餐?')"----正确提示。
onclick="return confirm('确定要定餐'+document.form.orderNum.value+'份?')"----不提示。

怎么在确认提示里面加上动态的 页面输入的数据?

不能直接使用onclick="return confirm('确定要定餐'+document.form.orderNum.value+'份?')"
document.form.orderNum.value 本身就是有逻辑操作的,写一段js调用,逻辑操作完之后再弹出对话框。

检查你有没有指定表单的“name”属性
你的表单名是否为:“ form ”