This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function select(element) { | |
var selectedText; | |
var isReadOnly = element.hasAttribute('readonly'); | |
if (!isReadOnly) { | |
element.setAttribute('readonly', ''); | |
} | |
element.select(); | |
element.setSelectionRange(0, element.value.length); | |
if (!isReadOnly) { | |
element.removeAttribute('readonly'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 离开页面弹出提示代码: 绑定beforeunload事件 | |
addBeforeunload: function() { | |
this.delBeforeunload(); | |
$(window).bind('beforeunload',function(e){ | |
var confirmationMessage = '确定离开此页吗?本页不需要刷新或后退'; | |
(e || window.event).returnValue = confirmationMessage; | |
return confirmationMessage; | |
}); | |
}, | |
//离开页面弹出提示代码: 解除绑定 |