In java you would be correct, but in javascript you need only say var or say nothing at all. I didn't bother pasting the function declaration since I pass nothing into it and I know it works already; the function is declared and called correctly but the code itself will not run.
Have a great day, Alex
----- Original Message ----- From: "Sina Bahram" <sbahram@xxxxxxxxx To: <programmingblind@xxxxxxxxxxxxx Date sent: Wed, 6 Feb 2008 22:31:52 -0500 Subject: RE: a quick js code question
All of it must not have copied since the closing of the catch
block and the
function isn't pasted; however, my simple glance at this shows
me that
there is no type definition for x. Sorry if that's not needed.
I remember
that the var keyword was used in jscript a while back, but that
could only
be for higher level variables, per haps?
Take care, Sina
-----Original Message----- From: programmingblind-bounce@xxxxxxxxxxxxx[mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Alex
Hall
Sent: Wednesday, February 06, 2008 10:08 PM To: programmingblind@xxxxxxxxxxxxx Subject: a quick js code question
Hi all,I have a very simple program that, for some reason refuses to
run. I have
this function being called by a button and that part works, but I
cannot get
an answer out of this function. It seems to stop at where I
declare x as a
variable. The code, all 12 lines of it, is below. If anyone can
point out
what I know must be a very simple error I would really appreciate
it.
function eq(){ try{ x=eval(form.in.value); ans=(x-2)/(x*x)-4; form.out.value=ans;
catch(err){ alert(err+": "+err.description);
Have a great day, Alex __________ View the list's information and change your settings at //www.freelists.org/list/programmingblind
__________ View the list's information and change your settings at //www.freelists.org/list/programmingblind
__________View the list's information and change your settings at //www.freelists.org/list/programmingblind