Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6

Thread: need help

  1. #1
    New Coder
    Join Date
    Feb 2005
    Posts
    27
    Thanks
    0
    Thanked 0 Times in 0 Posts

    need help

    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>

  • #2
    Regular Coder
    Join Date
    Jan 2003
    Posts
    400
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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() )

  • #3
    teh Moderatorinator
    Join Date
    Sep 2004
    Location
    USA
    Posts
    2,472
    Thanks
    4
    Thanked 40 Times in 40 Posts
    Quote Originally Posted by itsmani1
    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...

  • #4
    Regular Coder
    Join Date
    Jan 2003
    Posts
    400
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Brandoe85
    No form tag, no body tag, spelt option wrong...
    lol, I completely missed that one Stupid Late Nights

  • #5
    New Coder
    Join Date
    Feb 2005
    Posts
    27
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  • #6
    teh Moderatorinator
    Join Date
    Sep 2004
    Location
    USA
    Posts
    2,472
    Thanks
    4
    Thanked 40 Times in 40 Posts
    Wow, i'll have to start using that <opstion> tag then... along with the valuse attribute...


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •