partial fix for https://sourceforge.net/tracker/?func=detail&aid=2788651&group_id=176962&atid=955896
This commit is contained in:
parent
3e7330cc2b
commit
82347ac0da
|
@ -1,12 +1,12 @@
|
|||
|
||||
function Calc()
|
||||
function Calc()
|
||||
{
|
||||
this.validate = validate;
|
||||
this.clear = clear;
|
||||
this.clearAll = clearAll;
|
||||
this.evaluate = evaluate;
|
||||
this.append = append;
|
||||
|
||||
|
||||
function validate(displayTextId, calcTextId, integral, separatorKey, e)
|
||||
{
|
||||
var key;
|
||||
|
@ -15,14 +15,14 @@ function Calc()
|
|||
key = e.keyCode; //IE
|
||||
else
|
||||
key = e.which; //Firefox
|
||||
|
||||
|
||||
if(key == 13 || key == 61) // Enter, =
|
||||
{
|
||||
evaluate(displayTextId, calcTextId);
|
||||
return false;
|
||||
}
|
||||
else if (key == 0) // control, delete, ...
|
||||
{
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (key == 8) // backspace
|
||||
|
@ -30,10 +30,10 @@ function Calc()
|
|||
return true;
|
||||
}
|
||||
else if (key >= 17 && key <= 20) // Control
|
||||
{
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (key == 32) // space
|
||||
else if (key == 32) // space
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ function Calc()
|
|||
}
|
||||
else if (key == 42 || key == 43 || key == 45 || key == 47) // *, +, -, /
|
||||
{
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
else if ( key == separatorKey && !integral)
|
||||
{
|
||||
|
@ -54,7 +54,7 @@ function Calc()
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function clearAll(calcTextId)
|
||||
{
|
||||
try
|
||||
|
@ -66,7 +66,7 @@ function Calc()
|
|||
{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function clear(calcTextId)
|
||||
{
|
||||
try
|
||||
|
@ -82,9 +82,9 @@ function Calc()
|
|||
catch (err)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
function evaluate(displayTextId, calcTextId, separator)
|
||||
{
|
||||
try
|
||||
|
@ -102,19 +102,20 @@ function Calc()
|
|||
result = result.replace(/\./, separator);
|
||||
}
|
||||
calcText.value = result;
|
||||
|
||||
|
||||
var displayText = document.getElementById(displayTextId);
|
||||
|
||||
|
||||
if (!displayText.readOnly && calcText.value != 'undefined')
|
||||
{
|
||||
displayText.value = calcText.value;
|
||||
setTimeout("document.getElementById('" + displayTextId + "').focus()", 100);
|
||||
}
|
||||
}
|
||||
catch (err)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function append(calcTextId, val)
|
||||
{
|
||||
var calcText = document.getElementById(calcTextId);
|
||||
|
|
Loading…
Reference in New Issue