Load content in a div by clicking on another div. How?


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: Load content in a div by clicking on another div. How?

  1. #1
    Join Date
    Aug 2007
    Posts
    1

    Load content in a div by clicking on another div. How?

    I have content in one div that I want to simply transfer to another div when I click on the entire div element.

    Also, I'm wondering how I can transfer content in a div to a form textfield box.

    Anybody have any ideas?

    Thanks a lot! I really appreciate it!

  2. #2
    Join Date
    Aug 2007
    Location
    Navi Mumbai
    Posts
    10
    Hi,

    I have written some code which might be helpful to you.

    ----------------------------------------------------------------
    <script>
    function transfertext(FrmName,div01,div02,mytext01) {
    var div1 = document.getElementById(div01);
    var div2 = document.getElementById(div02);
    var Field = eval("document." + FrmName + "." +mytext01);
    div2.innerHTML = div1.innerHTML;
    Field.value = div1.innerHTML;
    }
    </script>
    <form name="myform01">
    <div id="mydiv01" onClick="transfertext('myform01','mydiv01','mydiv02','mytext01');">My first text</div>
    <div id="mydiv02">My Second text</div>
    <input type="text" value="" name="mytext01">
    </form>
    -------------------------------------------------------------------------

    Jayant Patil
    Mumbai

  3. #3
    Join Date
    Jan 2008
    Posts
    1
    Thanks for that code you provided for the other guy. It became of great use to me!

  4. #4
    Join Date
    Aug 2007
    Location
    Navi Mumbai
    Posts
    10
    You are welcome!

Similar Threads

  1. Replies: 7
    Last Post: 02-24-2006, 11:56 AM
  2. Replies: 1
    Last Post: 06-25-2005, 01:30 AM
  3. Load Content. How to create this? Thank You.
    By shapper in forum ASP.NET
    Replies: 0
    Last Post: 04-21-2005, 07:32 AM
  4. Replies: 2
    Last Post: 03-16-2001, 09:56 AM
  5. Replies: 0
    Last Post: 03-14-2001, 02:03 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center