...

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



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

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

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

A1ien51
02-02-2005, 04: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....
Eric



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum