I have to enter a random value in a textarea
of a web site by using grease monkey script the text area didn\'t have an id
so document.getElementB
It might be helpful to use getElementsByTagName:
document.getElementsByTagName("textarea")[0]
Of course, if you have more than one textarea tag, you will have to distinguish between them based on properties they might have. Or, if you know your textarea resides inside a specific element which has an ID, you could try
document.getElementById("someparentid").getElementsByTagName("textarea")[0]