[Tutor] Python in HTML

Alan G alan.gauld at freenet.co.uk
Sun May 22 17:10:58 CEST 2005


> >You still aren't telling us what happens. Its very hard to find
> >a fault in a program when you have no idea what the problem is.

> Well, the language being Javascript, I unfortunately don't know what
> happened, because there are no IDE's for Javascript; it just fails
> silently, as Liam put it.

OK, unlock that silence by using lots of print statements
(or document.write() in Javascript terms). Check the value
of the strings you are using, the current index etc by printing
them on the web page. Stub out the calls to the player until
you are sure you are passing the correct values in.

> there was a random number generator selecting random songs directly
from
> the song list, meaning that songs were re-played before every song
had
> been played once.

So it sounds like an error in the copy mechanism... Liam(?) already
pointed out one possible cause, but the key to working in any language
is to break the program into bite size pieces and get them working
bit by bit. Sometimes that means taking out a bit that was working
before.

> also doesn't help that there are no Javascript IDE's available.  As
far
> as I know, the problem lies within some small syntax error.

Actually there are a few JavaScript IDEs around, Microsoft do one
for example.

> be a completely different problem. Due to the lack of output when
> Javascript crashes, I just don't know.

There is a JavaScript console that you can display and it sometimes
gives you some clues too. But the best bet is lots of write()
statements
IMHO.

Also the fact its one big file shouldn't be a problem. Provided you
make liberal use of functions to encapsulate the functionality and
keep those together in the head of the html then the amount of code
scattered through the html should be manageable.

Alan G.



More information about the Tutor mailing list