在我的页面中,我有以下脚本:
<script language="javascript">
var needToConfirm = true;
window.onbeforeunload = confirmExit;
function confirmExit() {
if (needToConfirm) {
return "You have attempted to leave this page. " +
"If you have made any changes to the fields without clicking the Save button, your changes will be lost." +
" Do you wish to proceed?";
}
}
</script>
我可以在这样的按钮中设置 needToConfirm 值:
<input type="submit" value="Save" name="_submitButton" onclick="needToConfirm = false"/>
我想知道在这样的 actionLink 中是否有类似的方法:
@Html.ActionLink("Remove this item", "RemoveItemEdit", new
{
@_cardID = Model.mPackToEdit.mListCardPack[i].mCard.mMasterCard.mCardID,
needToConfirm = false
})
我已经尝试过了,但它不起作用。