The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Bookmarklet problem
denmarks
post Nov 24 2008, 01:28 PM
Post #1


Advanced Member
****

Group: Members
Posts: 200
Joined: 17-January 08
Member No.: 4,734



NOTE: Ignore the space between java and script. The forum editor inserts it.

java script:document.getElementsByName('textarea1')[0].value+='aaaa';void 0

java script:document.getElementsByName('textarea2')[0].value+='bbbb';void 0

I have these two bookmarklets. They add text to the end of existing text in a field. Sometimes the field textarea1 exists and I use the first one. At other times only the second field exists and I use the second bookmarklet. I would like to combine them. I have tried

java script:document.getElementsByName('textarea1')[0].value+='aaaa';document.getElementsByName('textarea2')[0].value+='bbbb';void 0

but if there is no textarea1 it just ends and does not try textarea2. I there a way to have both parts and have it ignore any errors?

This post has been edited by denmarks: Nov 24 2008, 01:29 PM
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
denmarks
post Nov 24 2008, 04:14 PM
Post #2


Advanced Member
****

Group: Members
Posts: 200
Joined: 17-January 08
Member No.: 4,734



I found the solution. I use the TRY command around the first part and CATCH(err) around the second part.
try{xxxxx}catch(err){yyyyy};void 0
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 31st May 2020 - 12:51 PM