Hello every one!
I have a tricky Question for you all.
I have a text box on a page which is going to use eval to evaluate math functions. I would like to leverage eval but don't want the user to shoot them selves in the foot inadvertently.
can any one think of a way to get around the following:
where you can type any eval function you like?
The idea here is to have all my code as a member of proObj...
P.S. obviously this doesn't prevent the user from using fire bug etc its just to "safe" the eval box/
I have a tricky Question for you all.
I have a text box on a page which is going to use eval to evaluate math functions. I would like to leverage eval but don't want the user to shoot them selves in the foot inadvertently.
can any one think of a way to get around the following:
where you can type any eval function you like?
The idea here is to have all my code as a member of proObj...
Code:
var proObj={pro:"protected variable"}
function noscope(text)
{
var proObj=false;
var window=false;
var document=false;
try
{
eval(text);
}
catch(e)
{
alert("cought");
}
}
noscope('proObj.pro="boo"');
alert(proObj.pro);
P.S. obviously this doesn't prevent the user from using fire bug etc its just to "safe" the eval box/