However, it never seems to call the function resulting in the alert.
Anyone see something wrong?
alert(‘Next week’ + next-week);
^^^^^^^^^
That should be “next_week”.
Odds are you’re getting a JS error, but not seeing it. Turn on
whatever debugging you might have (firebug in firefox, or safari’s
debug inspector) and it will make this easy to catch.
However, it never seems to call the function resulting in the alert.
Anyone see something wrong?
alert(‘Next week’ + next-week);
^^^^^^^^^
That should be “next_week”.
Odds are you’re getting a JS error, but not seeing it. Turn on
whatever debugging you might have (firebug in firefox, or safari’s
debug inspector) and it will make this easy to catch.
-philip
I fixed this and turned on firebug.
I am now seeing the following error:
missing } in XML expression
[Break on this error] alert(‘test’);\n
I tried just the following to simplify things:
Which calls an empty function.
Now I am seeing the following:
syntax error
[Break on this error] }\n
Why is this the case? How could there be a syntax error?
As a side note, link_to_function is the work of the devil. You should
really be adding the listener unobtrusively using something like
jquery/lowpro/prototype rather than defining it inline like that.
Why is this the case? Â How could there be a syntax error?
I don’t know why the syntax error, but if I had this problem I would
keep deleting stuff till it goes away, then add it back to find
exactly the problem. I have pasted your script into a page of mine
and it does not give an error. Which line is the error reported on?
Are you sure the script is not inside another tag that is confusing
it? Try moving it out to the top level. Keep trying things till the
error goes away then work out what causes it.
I don’t know why the syntax error, but if I had this problem I would
keep deleting stuff till it goes away, then add it back to find
exactly the problem. I have pasted your script into a page of mine
and it does not give an error. Which line is the error reported on?
Are you sure the script is not inside another tag that is confusing
it? Try moving it out to the top level. Keep trying things till the
error goes away then work out what causes it.
Colin
Here is something interesting:
When I click on the link I see this error in firebug:
testjs is not defined
onclick(click clientX=71, clientY=479)HTsSTthn…RWQ%3D%3D (line 2)
[Break on this error] testjs();
Could it be that test.js is not being included? I see this when
checking the source:
So I would think that the function ‘testjs’ defined in test.js would be
defined. I tried moving the function into application.js with the same
result.