<script type="text/javascript">
function getElementsByValue(val, src) {
var tags;
var matches = [];
var i = end = 0;
if (document.getElementsByTagName) {
if (!src) {
src = document;
} else if (typeof (src) === 'string') {
src = document.getElementById(src);
}
tags = src.getElementsByTagName('input');
for (i, end = tags.length; i < end; i++) {
if (tags[i].value && tags[i].value == val) {
matches.push(tags[i].id);
tags[i] = null;
}
}
}
return matches;
}
var UpdateButtons = getElementsByValue("Update");
window.onbeforeunload = function () {
if (UpdateButtons.length > 0) {
confirm('You were editing, are you saving changes?')
}
}
</script>
Confirm page exit when there is an Update button on the page.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment