<! DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 transitional//en" > <ptml> <pead> <title>select-option on Click </title> <script type= "Text/javascript" > Function Simoptionclick4ie () {var evt=window.event; var selectobj=evt?evt.srcelement:null; IE only if (evt && selectobj && evt.offsety && evt.button!=2 && (evt.offsety > Sel Ectobj.offsetheight | | evt.offsety<0)) {//Record the original selected var oldidx = Selectobj.selectedindex; settimeout (function () {var option=selectobj.options[selectobj.selectedindex]; At this point, you can judge whether the oldidx equals Selectobj.selectedindex//To determine if the user clicked the same option, and then do different processing. Showoptionvalue (option)}, 60); } function Showoptionvalue (opt,msg) {//alert (' AA '); var now=new Date (); var dt= (1900+now.getyear ()) + '-' + (Now.getmonth () +1) + '-' +now.getdate () + ' +now.gethours () + ': ' +now.gethours () + ': ' + Now.getseconds () + '. ' +now.getmilliseconds (); var Resultzone=document.getelementbyid (' Reslut '); ResultZone.style.margin= "10px"; Resultzone.innerhtml=dt + "When clicked on:" + (opt.text + ' = ' +opt.value); } </script> </pead> <body> <select onclick= "Simoptionclick4ie ()" Arial "; font-size:13px; Color: #565553; Font-style:normal; Font-weight:normal; Text-decoration:none "> <!--below onclick=" Showoptionvalue (this) is prepared for FF and opera--> <option value= "1" onc Lick= "Showoptionvalue (This)" >aaaaa</option> <option value= "2" onclick= "Showoptionvalue (This)" > Bbbbb</option> <option value= "3" onclick= "Showoptionvalue (This)" >ccccc</option> </select> & Lt;div id= "Reslut" ></div> </body> </ptml>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]
Run the test.