These two scripts worked fine by themselves, but when I combined them onto one page, the swirling cursor trail started moving erratically. I found a FAQ link on
dynamicdrive.com's Web site, where I discovered that most JavaScript conflicts were caused by duplication of function, events, or variables. The most common conflict occurs when two or more scripts both use a "body onload" event handler. However, only the swirling cursor trail script contained this event handler, so this was not the cause of my page being inoperable.
I got lucky: I guessed that "var" used in the script's html meant "variable" and found a duplicate name of a variable called "var speed" in both scripts. I then skipped ahead to Chapter 3 in JavaScript A Beginner's Guide and learnt that a variable name has to be used later in the script, so I found all 4 occurrences, and changed the rainbow text script's variable name to "fastness." Both scripts then worked on my page!
|