Graham Hirst
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.valu e
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.substrin g(0,curlen gth-1)
document.Calc.display.valu e=curvalue
}
else
{
document.Calc.display.valu e += anystr
}
}
function Key(anystr){
var count=0
var curvalue = document.Calc.display.valu
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.substrin
document.Calc.display.valu
}
else
{
document.Calc.display.valu
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER