Results 1 to 3 of 3

Thread: document.getElementById(variable)

  1. #1
    Join Date
    Feb 2008
    Location
    Coventry
    Posts
    103
    Thanks
    5
    Thanked 8 Times in 8 Posts

    Exclamation document.getElementById(variable)

    ok guys this should be so simple, in fact it is so simple that its working...in firefox but not in IE?!?!

    Iv got to the point where its driving me nuts and what i have found is that for some reason when i put a variable in the document.getElementById() section, IE doesnt like it.

    http://www.mewan.net/mark/hwutl/index.php?id=8

    if you right click and view source then you will see how i put var string in section and how i build it.

    Code:
    var string = 'ajaxDiv' + div_id;
    document.getElementById(string).style.display = "block";
    xmlHttp.onreadystatechange=function() {
    if(xmlHttp.readyState==4) {
        var ajaxDisplay = document.getElementById(string);
        ajaxDisplay.innerHTML = xmlHttp.responseText;
    } else {
        var ajaxDisplay = document.getElementById(string);
        ajaxDisplay.innerHTML = "<p>Loading....</p>";
    }
    is there anything anyone can suggest? please im going nuts!
    The important thing is not to stop questioning. Curiosity has its own reason for existing.

  2. #2
    Join Date
    Jul 2006
    Location
    just north of Boston, MA
    Posts
    1,806
    Thanks
    13
    Thanked 72 Times in 72 Posts

    Default

    what is div_id? and where is that variable coming from

  3. #3
    Join Date
    Feb 2008
    Location
    Coventry
    Posts
    103
    Thanks
    5
    Thanked 8 Times in 8 Posts

    Default

    div_id is the 2nd variable sent through. its just a incrementor in php from a while loop.

    if you see further down the page, the main part. it has
    Code:
    <a href="#" onclick="ajaxFunction(this.id, 1)" id="4">Changes on the Farm</a>
    that is one of the examples, its the main part
    The important thing is not to stop questioning. Curiosity has its own reason for existing.

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
  •