admin [—»Sói™~]-[Ðại Ma Ðầu]
Giới tính : Chinese zodiac : Bài viết : 1042 Xu : 158 Thanked : 650 Sinh Nhật : 20/09/1990 Tham Gia : 15/07/2011 Tuổi : 34 Yahoo : Hà Nội Nghề Nghiệp : Giáo Sư Status : hgfggggggggggggg
Character sheet Tài Sản:
| Tiêu đề: [JS] Tránh mất nội dung khi post bài Sun Aug 07, 2011 4:33 pm | |
| Vào Templates > Post & Tin nhắn > Posting Body. Chèn đoạn này vào đầu - Code:
-
<script language=Javascript type=text/javascript> // Cross browser event handling for IE 5+, NS6+ and Gecko function addEvent(elm, evType, fn, useCapture) { if (elm.addEventListener) { // Gecko elm.addEventListener(evType, fn, useCapture); return true; } else if (elm.attachEvent) { // Internet Explorer var r = elm.attachEvent('on' + evType, fn); return r; } else { // nutscrape? elm['on' + evType] = fn; } }
// Add Listeners function addListeners(e) { // Before unload listener addEvent(window, 'beforeunload', exitAlert, false); }
// Exit Alert function exitAlert(e) { var msg = "You will lose information if it has not already been saved.";
// set event if (!e) { e = window.event; } if (e) { e.returnValue = msg; }
// return warning message return msg; }
// Initialise addEvent(window, 'load', addListeners, false); </script>
Khi post bài - đóng cửa sổ. Thông báo sau sẽ hiện ra [You must be registered and logged in to see this link.] Có thể sửa dòng var msg = "You will lose information if it has not already been saved."; thành tiếng Việt | |
|