Solved

Problem with Apperaence of dynamically populated listbox in Netscape

Posted on 2002-04-11
4
158 Views
Last Modified: 2008-07-03
I am populating a drop down listbox control dynamically through a javascript function.
The drop down list box is behaving well in IE
But in netscape(4.7x) the list box after droping does not expand. instead it gives a vertical scroll bar showing just one item.

Please solve the problem at the earliest
Thanks
0
Comment
Question by:srividyakrishnamurthy
4 Comments
 
LVL 30

Expert Comment

by:third
ID: 6933362
AFAIK, this can't be done. 'twas resolved in the later versions of netscape.
0
 
LVL 1

Expert Comment

by:nagarajan75
ID: 6933573
Hi Srividya,

Here is the code the answers your question.I have implemented two  methods of doing the above.One without the function and with the function.

Hope i have answered your question.

Regards,
Nagarajan.

<html>
<head>
     <title>Untitled</title>
     <script>
     var str=new Array();
     str[0]="India";
     str[1]="US";
     str[2]="UK";
     str[3]="Australia";
     str[4]="Singapore";
     
     var strNew=new Array();
     strNew[0]="HongKong";
     strNew[1]="NewZealand";
     strNew[2]="uk";
     strNew[3]="Australia";
     strNew[4]="Singapore";
     
     function populate(f){
          for(i=0;i<str.length;i++){
             f.selectBox.options[i].text=str[i];
          }
     }
     </script>
</head>

<body >
<form name="f">
Select Box1 <select name="selectBox">
<option>-----------
<option>
<option>
<option>
<option>
<option>
</select>
<br>
Select Box2
<select >
<script>
for(i=0;i<str.length;i++){
   document.write("<option>"+str[i]);
}

</script>
</select>
<input type="button" value="POPULATE Select Box1" onclick="populate(f)" >
</form>


</body>
</html>
0
 
LVL 22

Accepted Solution

by:
CJ_S earned 300 total points
ID: 6953387
The only way to do that is to make the selectbox appear the correct size at startup and replacing the option safter that. So:

<select ...>
<option>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</option>
<option>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</option>
<option>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</option>
<option>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</option>
</select>

CJ
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 7054553
Zero response to help given, finalized and closed.
Moondancer - EE Moderator
0

Featured Post

ScreenConnect 6.0 Free Trial

Check out the updates in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI that improves session organization and overall user experience. See the enhancements for yourself!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to use embargo Date/time in php 29 38
Trying to redirect after event in javascript 3 23
execute script based on HTML event 7 23
JavaScript let vs var 5 26
I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question