try something like<form method="post" name="form1" action="some.jsp">
<input type="hidden" name="ret">
<input type="button" value="test" onclick="testClick()">
</form><script language="javascript">
function testClick()
{
var bRet = confirm("确定或取消?");
if (bRet)
{
alert("you clicked 确定");}
else
{
alert("you clicked 取消");
}document.form1.ret.value = bRet;
document.form1.submit();
}
</script>
<input type="hidden" name="ret">
<input type="button" value="test" onclick="testClick()">
</form><script language="javascript">
function testClick()
{
var bRet = confirm("确定或取消?");
if (bRet)
{
alert("you clicked 确定");}
else
{
alert("you clicked 取消");
}document.form1.ret.value = bRet;
document.form1.submit();
}
</script>
你是用onclick事件来触发javascript函数的,能否在判断某条件成立时自动confirm,然后根据用户的选择来决定页面下面的转向?
what kind of condition? if it is related to the change of a textbox's value, you could something like<input type="text" onchange="testClick()">or<input type="text" onpropertychange="testClick()">for some other conditions, you could use setExpression method for a specific object