Web Analytics Made Easy -
StatCounter drop down onchange pass selected value to function?? - CodingForum

Announcement

Collapse
No announcement yet.

drop down onchange pass selected value to function??

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • drop down onchange pass selected value to function??

    ok this has got to be pretty simple,

    i have a dropdown and i want to pass the value of the drop down with 'sc' in front.. ie if the current drop down item had a value

    of 1 then i want to pass 'sc1' to my function..

    here is my dropdown, i am trying to call function expandcontent..

    Code:
    <select name="tradeID" class="formDropDownField" onChange="expandcontent(this, 'sc3')">

    here is a different way i thought of doing it but couldn't get it to work.. ???

    Code:
    <SCRIPT language=JavaScript>
    function myfunction(form)
    {
    var val=form.tradeID.options[form.tradeID.options.selectedIndex].value;
    expandcontent(val);
    }
    
    </script>
    
    //dropdown..
    <select name="tradeID" class="formDropDownField" onChange="myfunction(this.form)">

  • #2
    how about:

    Code:
    <select name="tradeID" class="formDropDownField" onchange="expandContent(this.options[this.selectedIndex].value);">

    Comment


    • #3
      thanks, thats what i was trying to do, incase anyone else is trying to do this it didn't work without the this in function -- function(this, value) --
      Code:
      <select name="tradeID" class="formDropDownField" onChange="expandcontent(this,this.options[this.selectedIndex].value);">

      Comment


      • #4
        could you paste your expandcontent function to show us why?

        Comment


        • #5
          sure,

          Code:
          function expandcontent(curobj, cid){
          if(!initialstate){
          sweeptoggle('contract', 1)
          document.getElementById('added').disabled=true
          }

          Comment


          • #6
            I got the code form dynamic drive,
            http://www.dynamicdrive.com/dynamici...chcontent2.htm

            also i have posted another problem i am having here if you know an answer?

            basically i have regions shown by the show hide that i have checkboxes in and i only want one region to have checkboxes checked.. maybe i can uncheck checkboxes when the region is hidden??

            (http://www.codingforum.net/showthread.php?t=98203)
            Last edited by john6767; Oct 11, 2006, 10:47 PM.

            Comment

            Working...
            X