text: ﻿function GetMaxLength(a) { return a.exMaxLen } function LimitInput(f, b) { var g, e, d, a, c = true, h = parseInt(GetSelectionLength(f)); if (GetMaxLength(f) != null) { a = parseInt(f.value.length); d = parseInt(GetMaxLength(f)); e = window.event ? b.keyCode : b.which; g = ((e < 32) || (e >= 33 && e <= 40) || (e === 46)); if (!g) { if ((a - h) >= d) { c = false } } if (a > d) { f.value = f.value.substring(0, d) } } b.returnValue = c; return (c) } function LimitPaste(f, d) { var b, c, e, a, g = true, h = GetSelectionLength(f); if (GetMaxLength(f) != null) { a = parseInt(f.value.length); e = parseInt(GetMaxLength(f)); b = window.clipboardData.getData("Text"); c = a + b.length - h; if (c > e) { g = false } } d.returnValue = g; return (g) } function GetSelectionLength(a) { if (a.selectionStart === undefined) { return document.selection.createRange().text.length } else { return (a.selectionEnd - a.selectionStart) } };