From b11b3444ca21a8b6e8c1a874abaf4e404cbfca42 Mon Sep 17 00:00:00 2001 From: "brade%netscape.com" Date: Fri, 16 Jul 1999 09:10:08 +0000 Subject: [PATCH] changes for forceInteger by pete@postpagan.com git-svn-id: svn://10.0.0.236/trunk@39673 18797224-902f-48f8-a5cc-f745e15eee43 --- .../ui/dialogs/content/EdDialogCommon.js | 31 ++++++------------- 1 file changed, 10 insertions(+), 21 deletions(-) diff --git a/mozilla/editor/ui/dialogs/content/EdDialogCommon.js b/mozilla/editor/ui/dialogs/content/EdDialogCommon.js index 37805d797ed..570315ddb3b 100644 --- a/mozilla/editor/ui/dialogs/content/EdDialogCommon.js +++ b/mozilla/editor/ui/dialogs/content/EdDialogCommon.js @@ -309,28 +309,17 @@ function SetPixelOrPercentByID(elementID, percentString) } } -// force integer by petejc (pete@postpagan.com) -function forceInteger(id) +// forceInteger by petejc (pete@postpagan.com) +function forceInteger(elementID) { -var isInteger = true; - - with (document) - { - var stringIn = getElementById(id).value; - var pat = /\D/g; - var check = stringIn.match(pat); - if (check) - { - isInteger = false; - } - else - { - isInteger = true; - } - } - dump("integer = "+isInteger+"\n\n"); - -return isInteger; + editfield = document.getElementById( elementID ); + if ( !editfield ) + return; + + var stringIn = editfield.value; + var pat = /\D/g; + + editfield.value = stringIn.replace(pat, ""); } // All dialogs share this simple method