Member Login

Remember Me
Forgot Password?
Join Us!

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.
Jobs from Indeed

Link To This Forum!

Partner Button
Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

dynamic list creation and IE7 problem

dynamic list creation and IE7 problem

I have a dynamic list creation script that I inherited that acts a little funny in IE7. The script is:


function fillCategory(){
 // this function is used to fill the category list on load
addOption(document.drop_list.Category, "High School", "High School", "");
addOption(document.drop_list.Category, "Middle School", "Middle School", "");
addOption(document.drop_list.Category, "Combined", "Combined", "");

function SelectSubCat(){
// ON selection of category this function will work

addOption(document.drop_list.SubCat, "", "--Trip--", "");

if(document.drop_list.Category.value == 'High School'){
addOption(document.drop_list.SubCat,"Belize", "Belize");
addOption(document.drop_list.SubCat,"Camp Joy", "Camp Joy");
addOption(document.drop_list.SubCat,"Cranks Creek", "Cranks Creek");
addOption(document.drop_list.SubCat,"Jamaica", "Jamaica");
addOption(document.drop_list.SubCat,"New Orleans 1", "New Orleans 1");
addOption(document.drop_list.SubCat,"New Orleans 4", "New Orleans 4");
addOption(document.drop_list.SubCat,"Tex Mex 1", "Tex Mex 1");
addOption(document.drop_list.SubCat,"Tex Mex 2", "Tex Mex 2");
addOption(document.drop_list.SubCat,"Yucatan, Mexico", "Yucatan, Mexico");
if(document.drop_list.Category.value == 'Middle School'){
addOption(document.drop_list.SubCat,"Chattanooga, TN (MS)", "Chattanooga, TN (MS)");
addOption(document.drop_list.SubCat,"Dungannon, VA", "Dungannon, VA");
addOption(document.drop_list.SubCat,"Tex Mex (MS)", "Tex Mex (MS)", "");
addOption(document.drop_list.SubCat,"West Virginia (MS)", "West Virginia (MS)");
if(document.drop_list.Category.value == 'Combined'){
addOption(document.drop_list.SubCat,"Chattanooga, TN", "Chattanooga, TN");
addOption(document.drop_list.SubCat,"Jackonsville, FL", "Jackonsville, FL");
addOption(document.drop_list.SubCat,"New Orleans 2", "New Orleans 2");
addOption(document.drop_list.SubCat,"New Orleans 3", "New Orleans 3");
addOption(document.drop_list.SubCat,"West Va 1 (Panther)", "West Va 1 (Panther)");
addOption(document.drop_list.SubCat,"West Va 2 (Welch)", "West Va 2 (Welch)");


function removeAllOptions(selectbox)
    var i;

function addOption(selectbox, value, text )
    var optn = document.createElement("OPTION");
    optn.text = text;
    optn.value = value;


ad I call it like:


    <td colspan="2" class="style3"><div align="right">Age Group:</div></td>
    <td class="style3"><div align="left">
            <select name="Category" id="Category" class="dropdown" onChange="SelectSubCat();">
                <option value="">--Age Group--</option>
    <td colspan="2" class="style3"><div align="right">Trip Attending:</div></td>
    <td class="style3"><div align="left">
            <SELECT id="SubCat" NAME="SubCat">
                <Option value="">--Trip--</Option>

where the form is


<form action="sonservants.asp" name="drop_list" method="post" onKeyUp="highlight(event)" onClick="highlight(event)" onSubmit="return isFormComplete(this);">

Now, what is happening is that with IE7 you cannot use your mouse to select anything from the drop down menus, bt you can select the select box and then use the arrow keys to select what you want to choose. So, any body have any thoughts on what the issue may be?


RE: dynamic list creation and IE7 problem

Where is your hightlight function? Could you provide a working example of the page or a link so we could test out what you are seeing?

RE: dynamic list creation and IE7 problem

No, I found the highlight function:


//Function to highlight form element
function highlight(e){
eventobj=ns6? : event.srcElement
if (previous!=''){
if (checkel(previous))''
if (checkel(eventobj))
if (checkel(eventobj))

RE: dynamic list creation and IE7 problem

I don't exactly know why but your highlight function is reseting the form elemnt. It could be something do to with ie redraw of the select list. I havn't been able to test any futher than that. To make your code work in ie for select lists call your highlight function from onactivate instead of onclick.


<form action="sonservants.asp" name="drop_list" method="post" onkeyup="highlight(event)" onactivate="highlight(event)"  onsubmit="return isFormComplete(this);">

unfortunatly this will break your code in other browsers like firefox. So you may have to code branch and have one highlight function for ie and another for firefox. Or branch with logic. Make sure you remove


from your ie versions as that is what is keeping select list from working properly.

RE: dynamic list creation and IE7 problem

Interesting. I just removed that call altogether and it works fine for both browsers. However, I left



and that works just fine in both firefox and IE7. Anyway, thanks for the help!


Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close