Copy link to clipboard
Copied
I cannot get my head around what seems to be a simple problem. Dreamweaver keeps getting an error code for "special characters must be escaped" for these two lines of code:
/* If the ball is about to go off screen horizontally, reverse
* the direction of the ball */
if ( x < 0 || x > 290)
dx = -dx;
/* If the ball is about to go off screen vertically, reverse
* the direction of the ball */
if ( y < 0 || y > 305)
dy =- dy;
It keeps marking the error where the comparisson operators "<" and the ">" are used. Any ideas?
Copy link to clipboard
Copied
Have a look on the right side of your post,
In particular:
Copy link to clipboard
Copied
Thank you Ben for your quick reply!
I had already read all other posts regarding this similar issue. From what I have read, most folks have issues with unclosed statements, php, and others. Mine simply does not allow me to use the two comparison operators, without flagging the line for an error and allowing me to continue.
I went to the W3Schools site and it provides some clues about using “escape characters” using strings in JavaScript, but… as these two comparison operators “< >” are not used with strings inside “quotation marks” rather by using just numbers, and it is the reason why I cannot tell what Dreamweaver is suggesting to fix.
PS. The file is an HTML document.
Copy link to clipboard
Copied
I don't get any validation errors with the code you've posted, when placed within <script> tags in the <head> of a new .html page.
Could you copy and paste the entire code of the page here in the forum?
That particular error usually doesn't have much to do with the line it appears on. Normally, there will be a problem earlier in your code that's confusing the linting tool, and DW finally gives up at the line that gets highlighted.