By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,608 Members | 1,925 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,608 IT Pros & Developers. It's quick & easy.

How can i get to the textarea in Gmail Draft.

P: n/a
I am trying to make a bookmarklet to enlarge textarea in Gmail. But I
can't get to the textarea.
When you are composing a message in Gmail, the page has two frames. the
first frame has name "main". That frame contains a textarea named
"msgbody" in which you compose messages.

I have tried with Firebug getElementsByTagName and getElementsByName
but all fails.
self.main.document.getElementsByTagName('textarea' ) returns empty list.
self.main.document.getElementsByName('msgbody') also returns empty
list.
I suspect that it is because the textarea is buried deep in the DOM
tree.
The dom path from the main frame to the textarea is:
/html/body/table/tbody/tr[2]/td[2]/form/table/tbody/tr[5]/td/div[3]/table/tbody/tr[2]/td[2]/textarea

However the dom path from the main frame to the first div element is
/html/body/div
and self.main.document.getElementsByTagName('div') returns a nonempty
list.

Jul 10 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a


HopfZ wrote:

I have tried with Firebug getElementsByTagName and getElementsByName
but all fails.
self.main.document.getElementsByTagName('textarea' ) returns empty list.
Then what you think is a textarea is not one or that textarea is in a
different document.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 10 '06 #2

P: n/a
Martin Honnen wrote:
HopfZ wrote:

I have tried with Firebug getElementsByTagName and getElementsByName
but all fails.
self.main.document.getElementsByTagName('textarea' ) returns empty list.

Then what you think is a textarea is not one or that textarea is in a
different document.

Thank you for your answer.
I found that there was an iframe between the main frame and the
textarea.
The name of the iframe is v1 or v2 depending on situations.

// get to the composing textarea in Gmail. (new message or a saved
draft)
var textArea1 = self.main.v1.document.getElementById('ta_0');
var textArea2 = self.main.v2.document.getElementById('ta_compose') ;
var theComposingTextArea = textArea1 ? textArea1 : textArea2;

Jul 11 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.