W3C home > Mailing lists > Public > www-html@w3.org > September 1998

What event to trigger to position focus back to a <SELECT>(drop-down list ctrl) control?

From: Amit Rekhi <amit@abinfosys.com>
Date: Mon, 14 Sep 1998 20:05:51 +0530
Message-ID: <005201bddfec$f8ddc000$0101a8c0@server.abinfosys.com>
To: "HTML LIST" <www-html@w3.org>
Hello All.

Web Browser :- IE 4.01

   Under what event should I trigger a script (attached to a drop down list
box) which would position focus back to it's attached drop down list box in
case the script fails?
   Let me explain :-


I am constructing a drop down list box as follows :-
<select ID ="TEST" ????="Test(this)"> 
<option value="Test">Test</option>      
<option value="Run">Run</option>

The script Test(this) is as follows :-
         function Test(id)
          if(id.value != "Test")
           alert("Select TEST");
           return false;


* I want that if I do not select "Test" from the drop down list box, then
focus should be retained by the parent <SELECT> element, this should happen
until I select TEST from the drop down list box.


1) I do not know which event to attach Test(id) to in order to achieve my
objective. I have tried

  * OnChange() but it does not give control back to <SELECT id="TEST".... >
in case the script returns false.
  * OnBlur() and OnClick() , but both seem to go into an endless infinite
loop if Test(id) is attached to them.


1)How to achieve my objective of having the <SELECT id="TEST"..> to retain
control, in case the script returns false?
2) What event to attach script Test(id) for it to achieve my objective (for
objective see above)?

Thanks in advance for any answers,

Received on Monday, 14 September 1998 10:30:13 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:05:48 UTC