PDA

View Full Version : problem in select


souravsasi
10-01-2002, 06:58 AM
Hi,
I have a .php file. If i select a item form the select menu,The corresponding file has to be called and the last value in the select menu will be selected.loading select option is dynamic(from .php file).


function test(targ,selObj,restore){
eval(targ+".location='test.php?programno="+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
<form name=testfm option action="">
<select name='program' onChange="test('parent',this,0)"> <option value='1'>1</option><option value='2'>2</option><option value='3'>3</option> </select></form>


can any one help me



sasi.

ShriekForth
10-01-2002, 04:01 PM
I am not sur eI undertand what you are asking. What you have there seems to work. Do you mean for the select box to change to display "Select Loading" while it goes out and gets the page?


function test(targ,selObj,restore){
if (selObj.selectedIndex = selObj.length -1){
eval(targ+".location='test.php?programno="+selObj.options[selObj.selectedIndex].value+"'");
selObj.selectedIndex =selObj.length -1 ;
if (restore) selObj.selectedIndex=0;
}
}


<form .....
<option>Select Loading</option>
</select></form>


Just leave hardcode the last optin into the form. If that is not it, try explaining it one more time.

ShriekForth