Very strange javascript error

Some strange javascript errors happen in the situation:
Browser commits a xmlhttprequest to rails server,which will response
some DOM data and javascript scriplets to add some operation to those
DOM data.
All the following script are the responseText from webrick.
Error 1):

The above code will through “Circle undefined” error under both
firefox1.5 and IE6

This code will work normally,therefore,the following returned code will
also through “xx undefined” error

What a strange!

Error 2):
Considering the follwing three scriptlets as a responseText to ajax
request:
code one:

code two:

code three:

Of the three scriplets,only the last one will work normally,the former
two will cause Firefox1.5 to collapse! (All three codes will be normal
under IE)
Oooo~~~~~~

Anyone who can explain me for these errors?