473,396 Members | 1,996 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Dynamic Div Problem

Hi all,
I have a prob regarding javascript.
I have a Div in my web page, Now i get that div by getElementById("myDiv") and
append it to a dynamic Div created in the javascript file by appendChild(xx). This works fine for the first time.
But from the next time it will loose the Div in the page and showing null. WHY ??

My code :
Html Page:
Expand|Select|Wrap|Line Numbers
  1.       <Html>
  2.       <body>
  3.           <div id="myDiv"></div>
  4.           <input type="Button" onclick="doSMT();" />
  5.       </body>
  6.  
  7.       </Html>
javascript:
Expand|Select|Wrap|Line Numbers
  1.       function doSMT()
  2.        {
  3.        var xx = document.getElementById("myDiv");
  4.        var yy=document.createElement("DIV");
  5.        yy.appendChild(xx);  <== Problem is Here for second run of this function
  6.        }                                     (ie, for second click)
May 15 '09 #1
5 1387
acoder
16,027 Expert Mod 8TB
Surely, you mean:
Expand|Select|Wrap|Line Numbers
  1. xx.appendChild(yy);
?
May 15 '09 #2
No Sir, the problem is appending a div to a dynamic div.
the code attached is what i mean.
May 15 '09 #3
acoder
16,027 Expert Mod 8TB
You need to append this div to the body:
Expand|Select|Wrap|Line Numbers
  1. document.body.appendChild(yy);
May 15 '09 #4
Still my problem remains.
actually i am unable to get the static div after appending it to a dynamic div.
Am i conceptually wrong ?
May 16 '09 #5
Dormilich
8,658 Expert Mod 8TB
do you want to copy the static div into the new one or move it there?
May 17 '09 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Stephen Gennard | last post by:
Hello, I having a problem dynamically invoking a static method that takes a reference to a SByte*. If I do it directly it works just fine. Anyone any ideas why? I have include a example...
6
by: MikeY | last post by:
Hi Everyone, Does anyone know where I can get my hands on a sample with source code of a simple dynamic button control in C# Windows form. I am looking for a sample that uses a class library...
7
by: serge | last post by:
How can I run a single SP by asking multiple sales question either by using the logical operator AND for all the questions; or using the logical operator OR for all the questions. So it's always...
3
by: NateDawg | last post by:
I'm reposting this. I'm kinda in a bind untill i get this figured out, so if anyone has some input it would sure help me out. Ok, I’ve noticed a few gridview problems floating around the forum....
6
by: Tom | last post by:
I am developing my pages on my development machine and then copying to the production server. I am not pre-compiling, I am using the 'dynamic compile' feature. This is working fine except that...
2
by: Ghada Al-Mashaqbeh via DotNetMonster.com | last post by:
Hi all, I am facing a problem in dynamic code generation at run time, the problem occurs when the dynmaic code use global data exist within the original application. Lets say that my...
9
by: Tarscher | last post by:
hi all, I have this seemingly simple problem. I have lost a lot of time on it though. When a user selects a value from a dropdownlist (static control) a dynamic control is generated. I have...
2
by: linda.chen | last post by:
Greeting. We have a web service which is written in ASP.net (C#). When a user makes a request, it takes a while (average 100 seconds) to get the response. One of our users has dynamic IP...
0
by: tickle | last post by:
Need to convert this PL/SQL script to Dynamic SQL Method 2 * copybook - celg02u3.sql SIR 24265 * * updates dt_deny for all rows in * * ...
5
by: bearophileHUGS | last post by:
I often use Python to write small programs, in the range of 50-500 lines of code. For example to process some bioinformatics data, perform some data munging, to apply a randomized optimization...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.