Well, first of all, I can't figure out what you're trying to do with this function.
Do you know yourself what should be happening when you call it?
Well, In the "for" statement, you're using "document.write" which returns javascript string object. And string object has two properties:
* length - The number of characters in the string.
* prototype - For creating more properties
See yourself:
for(x in document.write){
alert('type:'+typeof(x)+',length:'+x.length);
}
Then you're trying again to write string object into browser.
I assume Firefox displays "prototype" as the last property found for this object . And only God knows what's happening with IE......
You should check javascript reference on strings:
http://www.javascriptkit.com/jsref/string.shtml