Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 09-18-2012, 12:24 PM   PM User | #1
sourabh1989
New Coder

 
Join Date: Jul 2012
Posts: 20
Thanks: 3
Thanked 0 Times in 0 Posts
sourabh1989 is an unknown quantity at this point
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???
sourabh1989 is offline   Reply With Quote
Old 09-18-2012, 03:31 PM   PM User | #2
devnull69
Senior Coder

 
Join Date: Dec 2010
Posts: 2,245
Thanks: 10
Thanked 531 Times in 525 Posts
devnull69 will become famous soon enough
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.
devnull69 is offline   Reply With Quote
Old 09-19-2012, 04:56 AM   PM User | #3
sourabh1989
New Coder

 
Join Date: Jul 2012
Posts: 20
Thanks: 3
Thanked 0 Times in 0 Posts
sourabh1989 is an unknown quantity at this point
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
sourabh1989 is offline   Reply With Quote
Old 09-19-2012, 07:41 AM   PM User | #4
Philip M
Supreme Master coder!

 
Philip M's Avatar
 
Join Date: Jun 2002
Location: London, England
Posts: 17,043
Thanks: 197
Thanked 2,412 Times in 2,390 Posts
Philip M has a spectacular aura aboutPhilip M has a spectacular aura aboutPhilip M has a spectacular aura about
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.
Philip M is offline   Reply With Quote
Old 09-19-2012, 09:40 AM   PM User | #5
sourabh1989
New Coder

 
Join Date: Jul 2012
Posts: 20
Thanks: 3
Thanked 0 Times in 0 Posts
sourabh1989 is an unknown quantity at this point
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.
sourabh1989 is offline   Reply With Quote
Reply

Bookmarks

Tags
javascript

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:18 PM.


Advertisement
Log in to turn off these ads.