Link to home
Start Free TrialLog in
Avatar of Graham Hirst
Graham HirstFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Unexpected Quantifier error in Javascript

Hi I am getting an 'Unexpected Quantifier' error in javascript. The function is as follows:

function Key(anystr){
      
var count=0
var curvalue = document.Calc.display.value
var curlength
      
 if (anystr.match("/"))
{
count++
}
 if (anystr.match("*"))
{
count++
}
if (anystr.match("+"))
{
count++
}
 if (anystr.match("-"))
{
count++
}
if (anystr.match("."))
{
count++
}       
            
 if(count>1)
{
curlength=curvalue.length;
alert("You cannot enter more than one operator in a calculation")
curvalue=curvalue.substring(0,curlength-1)
document.Calc.display.value=curvalue
}
        
else
 {
document.Calc.display.value += anystr
 }
}

ASKER CERTIFIED SOLUTION
Avatar of nimaig
nimaig
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Graham Hirst

ASKER

That worked!! Many Thanks for your help