Solved

Problem with Apperaence of dynamically populated listbox in Netscape

Posted on 2002-04-11
4
168 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

This article discusses how to create an extensible mechanism for linked drop downs.
This article discusses how to implement server side field validation and display customized error messages to the client.
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…
Suggested Courses

623 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