...

View Full Version : need help



itsmani1
02-03-2005, 06:23 AM
in this code i am trying to get the value of category but i m not able to do so?
can any one help me?


<html>
<head>
<script language="JavaScript" type="text/javascript">

function Fxn(){
var temp = document.form1.category.selectedIndex;
alert (temp);
}
</script>

</head>

<select name="category" id="category" onChange="Fxn(test);">
<opstion valuse ="test">test</option>
</select>
</html>

l3vi
02-03-2005, 06:30 AM
Hey, im not sure if this would work, but it should:

(put the following inside the fXN function)

var object = document.getElementById("category");
var value = object.options[object.selectedIndex].value
alert(value);

Oh yeah, btw, get rid of the "test" where you call the function.. (change Fxn(test) to Fxn() ;) )

Brandoe85
02-03-2005, 06:34 AM
in this code i am trying to get the value of category but i m not able to do so?
can any one help me?


<html>
<head>
<script language="JavaScript" type="text/javascript">

function Fxn(){
var temp = document.form1.category.selectedIndex;
alert (temp);
}
</script>

</head>

<select name="category" id="category" onChange="Fxn(test);">
<opstion valuse ="test">test</option>
</select>
</html>
No form tag, no body tag, spelt option wrong...

l3vi
02-03-2005, 06:37 AM
No form tag, no body tag, spelt option wrong...

lol, I completely missed that one :D Stupid Late Nights :rolleyes:

itsmani1
02-03-2005, 10:27 AM
problem is solved now :)
any way thanks people for ur help and replies
i solved it in this way:

function Fxn(){
var temp = document.form1.category.value;
alert(temp1);
alert (temp);
window.location.replace("editproduct.php?category=" + temp);
}

every one was saying that u did not ues form tags this was not the
problem i used all the teags in my code but did not used while posting,
i was excepting tht you will understand it by ur self.
any way thanks again

Brandoe85
02-03-2005, 12:46 PM
Wow, i'll have to start using that <opstion> tag then... :cool: along with the valuse attribute... :rolleyes:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum