AJAX innerHTML problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • nogueira_cristina@hotmail.com

    AJAX innerHTML problem

    Hello,

    I hope someone can clarify the following for me.

    I have page which replaces the code of a certain <divtag with other
    code (which on itself contains another div).
    The replacing of the code is done with AJAX.
    All divs have their id's set.
    The first replacement works fine.
    But I want the code in the second div (which is code that has been put
    in by the first replacement) to be replaced by the use of AJAX again.
    Somehow i can read the code which is in this second div. But replacing
    it doesn't work.

    Here is the example:
    This is the code that is put in a div with the first replacement.
    In this code there is a div called "divslct2" which contains a select
    box which needs to be replaced
    by other code depending on the first select box.
    The changeSlct() function uses AJAX to replace this code.
    If i put this code directly in the initial page that is loaded (so it
    won't be inserted by the first replacement) it works all fine. But
    when it's inserted by AJAX, i can't replace the code within the the
    div "divslct2". While i can read the code inside it just fine.
    What is going wrong?

    <form method="get" name="testform" >
    <table cellspacing="0" cellpadding="0" border="0">
    <tr>
    <td>1a</td>
    <td>
    <select name="slct1" onChange="chang eSlct('divslct2 ');">
    <option value="s11">1</option>
    <option value="s12">2</option>
    </select>
    </td>
    <td>1b</td>
    <td>
    <div id="divslct2">
    <select name="slct2" id="slct2">
    <option value="s21">1</option>
    <option value="s22">2</option>
    </select>
    </div>
    </td>
    </tr>
    </table>
    </form>



  • Captain Paralytic

    #2
    Re: AJAX innerHTML problem

    On 6 May, 15:56, nogueira_crist. ..@hotmail.com wrote:
    Hello,
    >
    I hope someone can clarify the following for me.
    >
    I have page which replaces the code of a certain <divtag with other
    code (which on itself contains another div).
    The replacing of the code is done with AJAX.
    All divs have their id's set.
    The first replacement works fine.
    But I want the code in the second div (which is code that has been put
    in by the first replacement) to be replaced by the use of AJAX again.
    Somehow i can read the code which is in this second div. But replacing
    it doesn't work.
    >
    Here is the example:
    This is the code that is put in a div with the first replacement.
    In this code there is a div called "divslct2" which contains a select
    box which needs to be replaced
    by other code depending on the first select box.
    The changeSlct() function uses AJAX to replace this code.
    If i put this code directly in the initial page that is loaded (so it
    won't be inserted by the first replacement) it works all fine. But
    when it's inserted by AJAX, i can't replace the code within the the
    div "divslct2". While i can read the code inside it just fine.
    What is going wrong?
    >
    <form method="get" name="testform" >
    <table cellspacing="0" cellpadding="0" border="0">
    <tr>
    <td>1a</td>
    <td>
    <select name="slct1" onChange="chang eSlct('divslct2 ');">
    <option value="s11">1</option>
    <option value="s12">2</option>
    </select>
    </td>
    <td>1b</td>
    <td>
    <div id="divslct2">
    <select name="slct2" id="slct2">
    <option value="s21">1</option>
    <option value="s22">2</option>
    </select>
    </div>
    </td>
    </tr>
    </table>
    </form>
    Since you have not posted any of the code that performs the task,
    there is nothing we can advise you on.

    Comment

    Working...