Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Jul 2012
    Posts
    20
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Updating a div with file

    I want to insert a file into a div. my code is below.

    Code:
     
    <html>
      <head>
      <script src="table.js"></script>
      <link rel='stylesheet' type='text/css' href='table.css'>
      
      <script ="text/javascript">
      function help_file(value) {
        
        document.getElementById('help').location.href= value;
        
      }
      </script>
          
      </head>
      <body>
        <div class="toc">
        <h2>Existence Checks</h2>
        <ul>
    
          <li><a onclick="lib(FRS_existance_lib); help_file('../../../scripts_block/html/help_syntax.html');"><h3><u>Library Data</u></h3></a> </li>
         
        </ul>
    
        <h2>POK Checks</h2>
        <ul>  
          <li><a onclick="html_table(FRS_ccs); parent.help.location='help_pok_pm_cells_check.html';"><h3><u>CCS POK Cells Summary</u></h3></a></li>
          </ul>
      </div>
      <div id="help" class="help">HELP</div>
      <div id="content" class="content"></div>
      </body>
    </html>
    I have three div as in code. i want that when i click on the contents a file is opened in div with id "help"... Is it possible???

    Can someone help me out???

  • #2
    Senior Coder
    Join Date
    Dec 2010
    Posts
    2,398
    Thanks
    12
    Thanked 570 Times in 563 Posts
    This is a typical AJAX task. Please take a look at the thousands of examples you will find on this forum as soon as you search.

    Your example will not work. A DIV element does not have a location property.

  • #3
    New Coder
    Join Date
    Jul 2012
    Posts
    20
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by devnull69 View Post
    This is a typical AJAX task. Please take a look at the thousands of examples you will find on this forum as soon as you search.

    Your example will not work. A DIV element does not have a location property.
    I dont have any knowledge about ajax. Can this be achieved through javascript or anything else..?? Just provide me some reference what should i search for because i searched alot didn't got anything useful.

    Any guidence or some short example you can provide will be very helpful

  • #4
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,158
    Thanks
    203
    Thanked 2,548 Times in 2,526 Posts
    I don't think you are trying. There is a whole sub-forum here devoted to Ajax and Design. As devnull69 says, "Please take a look at the thousands of examples you will find on this forum as soon as you search."

    See also http://www.hunlock.com/blogs/AJAX_for_n00bs

    All the code given in this post has been tested and is intended to address the question asked.
    Unless stated otherwise it is not just a demonstration.

  • #5
    New Coder
    Join Date
    Jul 2012
    Posts
    20
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Philip M View Post
    I don't think you are trying. There is a whole sub-forum here devoted to Ajax and Design. As devnull69 says, "Please take a look at the thousands of examples you will find on this forum as soon as you search."

    See also http://www.hunlock.com/blogs/AJAX_for_n00bs
    Actually i was not getting what exactly should i search for but luckily i got my solution. Thanks guys for so much help.


  •  

    Tags for this Thread

    Posting Permissions

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