SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict Mr Jojo's Avatar
    Join Date
    May 2007
    Posts
    322
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Changing inner html of a div

    I have a file.php that will make an echo of an html code.
    I want to put that html code in a div with a press of a button.

    example:

    <div name="lol"></div>

    I press the button and i get:

    <div name="lol">13:02 PM and it's time for teh lulz</div>

    the inner html is generated by a php, that would be the same if a did in php this:

    echo '<div name="lol">';

    include <file.php>; //will return "13:02 PM and it's time for teh lulz"

    echo '</div>';

    But with javascript.

  2. #2
    SitePoint Zealot
    Join Date
    Mar 2006
    Posts
    139
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you could use jQuery to load the contents of another URL. View the following example at http://docs.jquery.com/Ajax/load#urldatacallback.

  3. #3
    Non-Member
    Join Date
    Aug 2007
    Posts
    50
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    document.getElementById('id_of_div').innerHTML = 'string';


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
  •