Is it possible to add some text inside DIV? |
Is it possible to add some text inside DIV? |
Nepal |
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 |
Lo-Fi Version | Time is now: 26th April 2024 - 02:56 AM |