The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

> Is it possible to add some text inside DIV?
Nepal
post Sep 21 2010, 03:19 PM
Post #1





Group: Members
Posts: 6
Joined: 18-September 10
Member No.: 12,753



Hi All,

Is there anyway to insert some text inside <div> using javascript. I have 3 div with different in different location of page, i need to make one javascript function which can insert text into selected <div> Below is the example what i am looking for.
CODE



<script language="javascript">
function insertintodiv(var txt, var ddiv)
{
    if(ddiv == "div1")
            //INSERT INTO DIV1
    elseif (ddiv == "div2")
            // INSERT INTO DIV2
    else
            // INSERT INTO DIV3
    
}

</script>

</head>

<body>


    <DIV id = "div1" STYLE="position:absolute; top: 85px; left: 131px; width: 200px; height: 25px;">  </DIV>
     <DIV id = "div2" STYLE="position: absolute; top: 85px; left: 427px; width: 200px; height: 25px;">  </DIV>
      <DIV id = "div3" STYLE="position: absolute; top: 85px; left: 728px; width: 200px; height: 25px;">  </DIV>

  
  <!-------------------------------- Some dynamic action ---------------------------------->
  <script language="javascript">
  insertintodiv("Columns 1", "div1");
  insertintodiv("Columns 2", "div2");
   insertintodiv("Columns 3", "div3");
  </script>



It will be great help if i can find some similar way to finish my dynamic portal.

Thank You
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Posts in this topic


Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 26th April 2024 - 02:56 AM