[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Javascript onChange()

Posted on 2004-05-03
4
Medium Priority
?
4,320 Views
Last Modified: 2008-01-16
hi

is there any way to get the previous value of a list box when calling the onChange function...

i mean i would like to get from which value the onchange is called.....

thx
Sumesh
0
Comment
Question by:sumachaa
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 7

Expert Comment

by:mark-b
ID: 10977655
onChange='alert( this.options[this.selectedIndex].value )'

-Mark
0
 
LVL 63

Expert Comment

by:Zvonko
ID: 10977880
No, there is no way.
You have to implement it to your way.
One possible way is to store in the onChange function the actual values as last selected value.
For that you can create a new select object attribute, for example: lastSelected, or lastValue
For the first check you have to loop trough all options and look for the defaultSelected attribute which is set to true.
0
 
LVL 7

Expert Comment

by:mark-b
ID: 10978020
Oops.  I didn't see the that you said 'previous'.  :(
0
 

Accepted Solution

by:
sachinkaggrawal earned 75 total points
ID: 10983896
there r some alternate ways which you can try...although there is no direct way.

what you can do is that u can write function to catch the value before the changes. this you can do in the two ways.

write a function on the on click and on keydown events. these will e fired before onchange.
and catch the value in some hidden fields or in some variables and use them afterwards.

i hope u can understand it.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question