創建用戶點擊的方式全頁面元素:
$('formId').observe(
'submit',
function() {
// create DIV with an id for possible later use
var blocker = new Element('div', {id: 'blocker'});
// expand to fill parent element
blocker.setStyle({
position: 'absolute',
left: 0,
top: 0,
width: '100%',
height: '100%',
zIndex: 1000 // overlay everything
});
// set whole body as parent
document.body.insert(blocker);
// prevent keyboard interaction too
this.blur();
}
);
現在很短的時間內表單提交沒有人可以改變任何領域(除了通過運行腳本)。如果你喜歡,你甚至可以給DIV添加一個等待消息,否則它對用戶是不可見的。
如果你通過AJAX提交表單我還添加了一個id
使得AJAX完成時,你可以$('blocker').remove();
我不是'prototype'的傢伙,但你就不能回' FALSE'? – gdoron 2012-03-13 23:12:56