- From: Amit Rekhi <amit@abinfosys.com>
- Date: Mon, 14 Sep 1998 20:05:51 +0530
- To: "HTML LIST" <www-html@w3.org>
Hello All. ENVIRONMENT 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 :- SCENARIO 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> </select> The script Test(this) is as follows :- . . . <SCRIPT LANGUAGE="JSCRIPT"> function Test(id) { if(id.value != "Test") { alert("Select TEST"); id.focus(); return false; } } </SCRIPT> OBJECTIVE * 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. PROBLEM 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. QUESTIONS 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, AMIT
Received on Monday, 14 September 1998 10:30:13 UTC