Click here to Skip to main content
15,507,406 members
Home / Discussions / Web Development
   

Web Development

 
Questionadding web service from ftp Pin
Maverickcool21-Aug-09 4:22
Maverickcool21-Aug-09 4:22 
QuestionHelp in creating Web Bot Pin
kc_krishnan20-Aug-09 23:55
kc_krishnan20-Aug-09 23:55 
AnswerRe: Help in creating Web Bot Pin
Ashfield21-Aug-09 2:35
Ashfield21-Aug-09 2:35 
Questioninversing an inner join without using left join Pin
mark_me20-Aug-09 15:22
mark_me20-Aug-09 15:22 
AnswerRe: inversing an inner join without using left join Pin
Ashfield20-Aug-09 22:31
Ashfield20-Aug-09 22:31 
GeneralRe: inversing an inner join without using left join Pin
mark_me21-Aug-09 7:10
mark_me21-Aug-09 7:10 
QuestionDisplaying a "wait" page while a CGI script executes? Pin
Sylv3320-Aug-09 7:54
Sylv3320-Aug-09 7:54 
QuestionJavascript - change dropdown.selectedIndex to selectedIndex from other dropdown Pin
CareyGrant20-Aug-09 7:22
CareyGrant20-Aug-09 7:22 
Hello All.

I'm trying to take the index of one dropdownList, and force the other DropDown list to be equal to the first (in terms of selectedIndex and item selected)

I can successfully retrieve the index of the first dropdown by using:

<pre> var ddIndex1 = document.getElementById('mylist1').selectedIndex;   </pre>

I have tried to assign the 2nd by doing the following:

<pre>document.getElementById('mylist2').selectedIndex = ddIndex1;</pre>
I then do:
<pre> alert(document.getElementById('mylist2').selectedIndex)   </pre> and I can see that the index has been modifed however, when I view my page, it still displays 'Select One' which is at Index0. WTF | :WTF:

Any ideas?

-Here is how the Drop Downs are generated-

<pre>
     // GENERATE DROP DOWN BOXES
     function _generateDropDown(oname,bname,btype,bfield,bvalue,allOptions,numOptions){
          this.o_name=oname;this.m_name=bname;this.m_type=btype;
          this.m_field=bfield;this.m_value=bvalue;
          this.m_allOptions=allOptions;this.m_numOptions=numOptions;
          var x = "";
          var myString = new String(allOptions);
          var myOptions= new Array(numOptions);
          var z=myString.length;
          var y=0;
          var currCharIndex=0;
          myOptions[0]='';

          try{
               // PUT ALL OPTIONS FOR THIS DROP DOWN INTO AN ARRAY
               for(i=currCharIndex; i&lt;z; i++){
                    if (myString.charAt(i) != ";"){
                         myOptions[y]=myOptions[y] + myString.charAt(i);
                         this.m_value=myOptions[y];
                    }
                    else if (myString.charAt(i) == ";"){
                         y++;
                         currCharIndex=i;
                         myOptions[y]='';
                    }
               }

               //WHEN A DATE IS SELECTED
               if (parent.dateIndex != -1){
                    complete_rs.movefirst;              
                    var x = new String(complete_rs(bfield));
                    if (x == "null" || x == "undefined" || x == "Select One"){
                         x = "";
                    }
               }
               //WHEN NO DATE IS SELECTED
               else if (parent.dateIndex == -1){
                    x = "";
               }

               if (this.m_name != "selectDate"){
                    document.writeln("&lt;select name=",this.m_name," onChange=",this.o_name,".updateDB(value)&gt;&lt;br /&gt;");
                    document.writeln("&lt;option value=\"Select One\"&gt;Select One&lt;/option&gt;");
                    for(i=0; i&lt;this.m_numOptions; i++){
                         if (myOptions[i]==x){
                              this.m_selected="selected";
                         }
                         else{
                              this.m_selected="";
                         }
                         document.writeln("&lt;option value=\"",myOptions[i], "\" ", this.m_selected,"&gt;",myOptions[i],"&lt;/option&gt;");
                    }
               }
               document.writeln("&lt;/select&gt;");
          }//END TRY
          catch(E){
               //alert("generateDropDown()"+ E);
          }//END CATCH
     }


</pre>

and here are my attempts, all which do not modify the drop down to change.
(ps. the value of the dropdown is added to the database afterwards)

<pre>

      var index1 = document.getElementById('mylist1').selectedIndex;

//this updates the index, however fails to change what is display in the dropdown list
      document.getElementById('mylist1').selectedIndex = index1;

//this updates the index, however fails to change what is display in the dropdown list
      document.getElementById('mylist1').options[index].value = index1;

//this updates the index, however fails to change what is display in the dropdown list
var tempDDL = document.getElementById('mylist1');
tempDLL.selectedIndex = index1;


</pre>

Any type of help or suggestions is greatly appreciated.

Cheers!!!
AnswerRe: Javascript - change dropdown.selectedIndex to selectedIndex from other dropdown Pin
CareyGrant20-Aug-09 7:26
CareyGrant20-Aug-09 7:26 
Questionasp/html/javascript Pin
rajiv_kadam20-Aug-09 0:43
rajiv_kadam20-Aug-09 0:43 
AnswerRe: asp/html/javascript Pin
Ashfield20-Aug-09 2:37
Ashfield20-Aug-09 2:37 
Questionshow/hide div Pin
vikas shukla19-Aug-09 22:48
vikas shukla19-Aug-09 22:48 
AnswerRe: show/hide div Pin
Aman Bhullar19-Aug-09 23:19
Aman Bhullar19-Aug-09 23:19 
GeneralRe: show/hide div Pin
vikas shukla20-Aug-09 1:25
vikas shukla20-Aug-09 1:25 
AnswerRe: show/hide div Pin
kc_krishnan20-Aug-09 1:30
kc_krishnan20-Aug-09 1:30 
GeneralRe: show/hide div Pin
vikas shukla20-Aug-09 1:50
vikas shukla20-Aug-09 1:50 
GeneralRe: show/hide div Pin
kc_krishnan20-Aug-09 2:01
kc_krishnan20-Aug-09 2:01 
AnswerRe: show/hide div Pin
Marc Firth20-Aug-09 3:51
Marc Firth20-Aug-09 3:51 
Questionasp/html/javascript Pin
rajiv_kadam19-Aug-09 22:05
rajiv_kadam19-Aug-09 22:05 
AnswerRe: asp/html/javascript Pin
Aman Bhullar19-Aug-09 23:21
Aman Bhullar19-Aug-09 23:21 
QuestionWebpage data entry without Navigating to the page Pin
kc_krishnan19-Aug-09 19:49
kc_krishnan19-Aug-09 19:49 
GeneralSimple SEO for one page site Pin
Brady Kelly19-Aug-09 8:37
Brady Kelly19-Aug-09 8:37 
QuestionNeed Solution for vulnerability "IIS 5.0 Denial of Service" Pin
Ankur.Bakliwal19-Aug-09 2:19
Ankur.Bakliwal19-Aug-09 2:19 
QuestionFacebook Notification [modified] Pin
sangeethanarayan19-Aug-09 1:31
sangeethanarayan19-Aug-09 1:31 
QuestionHow To Create a HTML Download Link Pin
Prasadsm19-Aug-09 0:12
Prasadsm19-Aug-09 0:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.