SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    Function Curry'er JimmyP's Avatar
    Join Date
    Aug 2007
    Location
    Brighton, UK
    Posts
    2,006
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    style.display not working in IE6

    Hi...

    Do any of you know why this would not be working in IE6 ???

    Code JavaScript:
    	if (document.getElementById("select_city")) {
     		var element1 = document.getElementById("select_city");
    		var element2 = document.getElementById("city_label");
    		var element3 = document.getElementById("spanplural");
    		element1.style.display = "inherit";
    		element2.style.display = "inherit";
    		element3.style.display = "inline";
    		}
    James Padolsey
    末末末末末末末末末末末末末末末末末末末
    Awesome JavaScript Zoomer (demo here)
    'Ajaxy' - Ajax integration solution (demo here)

  2. #2
    SitePoint Guru alecrust's Avatar
    Join Date
    Jun 2007
    Location
    London, UK
    Posts
    728
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Can people please post a link to where it isn't working.
    Honda Civic Forum - UK Civic Forum
    Web Host Reviews - Independent, honest host reviews
    My Portfolio - Simplicity is the ultimate sophistication

  3. #3
    SitePoint Wizard Pepejeria's Avatar
    Join Date
    Jan 2005
    Location
    Too far up north
    Posts
    1,566
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Or show more code, that looks correct.

  4. #4
    Function Curry'er JimmyP's Avatar
    Join Date
    Aug 2007
    Location
    Brighton, UK
    Posts
    2,006
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorry...

    Here is some more code:

    The function in the first post is called on the last line of this code below:

    Code JavaScript:
    var cities=[
    /*DEFAULT*/["Select Country Above"],
    /*Country1*/["city1","city2","Other Locations"],
    /*Country2*/["city1","city2"],
    /*Country3*/["city1","city2","city3","city4","city5","Other Locations"],
    /*Other Locations*/["Other Locations"],
    ];
     
    function select_city(idx) {
    var f=document.find_location;
    f.select_city.options.length=null;
    for(var i=0; i<cities[idx].length; i++) {
    	f.select_city.options[i]=new Option(cities[idx][i], i); 
        }    
    f.select_city.size=1;
    }
     
    window.onload=function() {
    select_city(0);
    document.find_location.select_country.onchange=function(){select_city(this.selectedIndex); [SIZE="4"]location_city_box()[/SIZE];};
    }

    This is the HTML:

    Code:
    <form id="find_location" name="find_location" method="get" action="location-function.php">
                    <label>Countries: <br />
                    <select name="select_country" class="formclass1" id="select_country">
                      <option value="select" selected="selected">-- Select a Country --</option>
                      <option value="Country1">Country1</option>
                      <option value="Country2">Country2</option>
                      <option value="Country3">Country3</option>
                      <option value="Other">Other Locations</option>
                    </select>
                    </label><br />
                    <label id="city_label">City/Town:<br />
                    <select name="select_city" class="formclass1" id="select_city">
                    </select>
                    </label>
    <input type="image" name="gobutton2" id="gobutton2" src="images/generic/go2.png" />
    <input type="image" name="gobutton2ie" id="gobutton2ie" src="images/generic/go2ie.png" />
                  </form>
    James Padolsey
    末末末末末末末末末末末末末末末末末末末
    Awesome JavaScript Zoomer (demo here)
    'Ajaxy' - Ajax integration solution (demo here)


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •