473,378 Members | 1,146 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

clearing onlclick event

Hi there, I used the following 2 functions to change the text on a button and open a hidden div at the same. I want to revert back to the original text on the button (read more..) when I click to close the div again.

Please help :D

Expand|Select|Wrap|Line Numbers
  1. function onclick(){
  2.     javascript:readmore('text1')
  3. }
  4.  
  5. function valChange(){
  6.     document.myForm.myButton.value="...reduce text"
  7. }
  8.  
May 19 '11 #1
1 1150
Dormilich
8,658 Expert Mod 8TB
make a new function that restores the original Text and interchange the two handlers each time the button is pressed.

ex.
Expand|Select|Wrap|Line Numbers
  1. function changeVal()
  2. {
  3.     this.value = "… reduce text";
  4.     this.removeEventListener("click", changeVal, false);
  5.     this.addEventListener("click", changeValBack, false);
  6. }
  7. function changeValBack()
  8. {
  9.     this.value = "… read more";
  10.     this.removeEventListener("click", changeValBack, false);
  11.     this.addEventListener("click", changeVal, false);
  12. }
  13. // button is the reference to the button element
  14. button.addEventListener("click", changeVal, false);
May 19 '11 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Santhoshi | last post by:
I have an event declared in class1 Now i want to raise the event in the my class2 or anywhere other than class1 Is it possible? If so how Thank you
13
by: Michael Kennedy [UB] | last post by:
Hi, I have a situation where I need to clear the event sinks from an event inside a custom class. But I don't know which methods signed up for that event. Consider the following example: ...
0
by: karunakar | last post by:
Hi All Here i want to show in datagrid Broder color as like image showed i attaching images pls check and help me out "Onlclick" i want to show red border color each row in DATAGRID in ASP.NET...
2
by: Brad | last post by:
A quick question... In my program I handle an event, but the way it is programed the event gets "handled" twice. Is there a way to clear the event after it is handled the first time Thank Brad
0
by: lulaleila | last post by:
Hi, I'm working in .NET framework programming a toolbar in c # for Internet explorer browser. I would like to handle the onlclick event on an IHTMLElment object in the web document; I found...
5
by: zlf | last post by:
I have an UserControl created by other component, its creator attachs some event handlers to MouseDoubleClick event, but I do not like those events to be triggered while it is db-clicked. I want to...
4
by: parez | last post by:
Hi, Whats the winforms equivalent of asp.net page load event? I am trying to clear a status message field every time a user clicks on any of the buttons..
4
by: =?Utf-8?B?TmF2YW5lZXRoLksuTg==?= | last post by:
Hi all, Recently I found an interesting question on C# forums about clearing event handlers of an event. I tried to give it a solution, but failed. I am interested to know how you guys take...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.