Help - Search - Members - Calendar
Full Version: Signature Bookmarklet
HTMLHelp Forums > Programming > Client-side Scripting
denmarks
I add a signature to many forums by using a bookmarklet. It just combines existing text with the signature. I must hard code each text box name to do it and it gets extremely complicated. Below is the bookmarklet. Is there a way to modify it so that it uses the text box with the cursor in it rather than a named one?
This one looks for "answer", "textarea2", "pmesg", and "answertext". I hate to keep adding more.

java script:try{document.getElementsByName('answer')[0].value+='\n\n%E2%82%AA%20%C9%A6%C9%99l%CA%9E%C9%B9%C9%90q%20%E2%82%AA'}catch(err){try{document.getElementsByName('textarea2')[0].value+='\n\n%E2%82%AA%20%C9%A6%C9%99l%CA%9E%C9%B9%C9%90q%20%E2%82%AA'}catch(err){try{document.getElementsByName('pmesg')[0].value+='\n\n%E2%82%AA%20%C9%A6%C9%99l%CA%9E%C9%B9%C9%90q%20%E2%82%AA'}catch(err){document.getElementsByName('answertext')[0].value+='\n\n%E2%82%AA%20%C9%A6%C9%99l%CA%9E%C9%B9%C9%90q%20%E2%82%AA'}}};void%200
Christian J
QUOTE(denmarks @ Aug 19 2009, 05:41 PM) *

I add a signature to many forums by using a bookmarklet. It just combines existing text with the signature.

Can't you enter the signature through your forum profile?

QUOTE
This one looks for "answer", "textarea2", "pmesg", and "answertext". I hate to keep adding more.

If there's just one TEXTAREA on the page you might look for

CODE
document.getElementsByTagName('textarea')[0]
denmarks
Thanks. That seems to work.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.