View Full Version : problem in fetching value from list/menu

02-02-2005, 02:56 PM
<script language="JavaScript" type="text/javascript">
function Fxn(){
var temp = document.form1.category.selectedIndex;
alert (temp);
window.location.replace("addnewproduct.php?category=" + temp);

<select name="category" id="category" onChange="Fxn(test);">
<option value="test1">test1</>
<option value="test2">test2</>
<option value="test3">test3</>

problem is with bold line ,
how can i fetch value on fxn?

02-02-2005, 03:37 PM
your example code does not have a form tag....

var sel = document.form1.category;
var text = sel.options(sel.selectedIndex).text;
var value = sel.options(sel.selectedIndex).value;

see if that helps....

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum