manipulating divs on the fly


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 5 of 5

Thread: manipulating divs on the fly

  1. #1
    Jason Guest

    manipulating divs on the fly


    I am attempting to hide a data panel on my screen and show a wait panel while
    extensive jscript edits are running. The script is not processing in order,
    and the code that sets the visible/hidden properties to the divs is being
    skipped unless I include an alert after the code to hide/show the panels.
    Could someone tell me why the code for the panels is not being executed before
    the function continues.

    Here is some of my code....

    function chkUpdateInit(x, e)
    {

    if (document.all)
    {


    parent.frames[1].document.all["DataPanel"].style.position = "absolute";
    parent.frames[1].document.all["DataPanel"].style.visibility = "hidden";
    parent.frames[1].document.all["WaitPanel"].top = e.y;
    parent.frames[1].document.all["WaitPanel"].style.visibility = "visible";
    alert("in the panels");

    //putting the alert in is the only way I have been able to get the code for
    the panels to execute before the function below


    }



    chkUpdate(x);

    }


    function chkUpdate(x)

    {
    ........


  2. #2
    Russell Jones Guest

    Re: manipulating divs on the fly

    Jason:

    The code isn't being skipped, otherwise the alert wouldn't execute either.
    The problem is that DHTML updates send messages to the various sub-windows
    that comprise the screen, and the app (because it's busy with the rest of
    your code) can't get free to read the messages from the queue. Try putting
    the lines that update the screen in a function and using window.setTimeout
    to call that function after a very short interval.

    Russell Jones
    Sr. Web Development Editor
    DevX.com

    "Jason" <jlmacmac@nscorp.com> wrote in message
    news:3ac0a2d4$1@news.devx.com...
    >
    > I am attempting to hide a data panel on my screen and show a wait panel

    while
    > extensive jscript edits are running. The script is not processing in

    order,
    > and the code that sets the visible/hidden properties to the divs is being
    > skipped unless I include an alert after the code to hide/show the panels.
    > Could someone tell me why the code for the panels is not being executed

    before
    > the function continues.
    >
    > Here is some of my code....
    >
    > function chkUpdateInit(x, e)
    > {
    >
    > if (document.all)
    > {
    >
    >
    > parent.frames[1].document.all["DataPanel"].style.position = "absolute";
    > parent.frames[1].document.all["DataPanel"].style.visibility = "hidden";
    > parent.frames[1].document.all["WaitPanel"].top = e.y;
    > parent.frames[1].document.all["WaitPanel"].style.visibility = "visible";
    > alert("in the panels");
    >
    > //putting the alert in is the only way I have been able to get the code

    for
    > the panels to execute before the function below
    >
    >
    > }
    >
    >
    >
    > chkUpdate(x);
    >
    > }
    >
    >
    > function chkUpdate(x)
    >
    > {
    > ........
    >




  3. #3
    Luke Guest

    Re: manipulating divs on the fly


    You probably need to make sure that there's an entry in the style sheet for
    this item, or else you're code won't work. Something like this in the
    style sheet would work:

    #DataPanel { position: absolute; visibility: hidden; }

    would do the job. Otherwise the browser doesn't know about it's
    style attributes.

    ..and I'm presuming that you're only supporting IE from the code you've
    noted!

    -Luke-

    "Jason" <jlmacmac@nscorp.com> wrote:
    >
    >I am attempting to hide a data panel on my screen and show a wait panel

    while
    >extensive jscript edits are running. The script is not processing in order,
    >and the code that sets the visible/hidden properties to the divs is being
    >skipped unless I include an alert after the code to hide/show the panels.
    >Could someone tell me why the code for the panels is not being executed

    before
    >the function continues.
    >
    >Here is some of my code....
    >
    >function chkUpdateInit(x, e)
    >{
    >
    >if (document.all)
    >{
    >
    >
    >parent.frames[1].document.all["DataPanel"].style.position = "absolute";
    >parent.frames[1].document.all["DataPanel"].style.visibility = "hidden";
    >parent.frames[1].document.all["WaitPanel"].top = e.y;
    >parent.frames[1].document.all["WaitPanel"].style.visibility = "visible";
    >alert("in the panels");
    >
    >//putting the alert in is the only way I have been able to get the code

    for
    >the panels to execute before the function below
    >
    >
    >}
    >
    >
    >
    >chkUpdate(x);
    >
    >}
    >
    >
    >function chkUpdate(x)
    >
    >{
    > ........
    >



  4. #4
    Jason Guest

    Re: manipulating divs on the fly


    yeah the div has an inline style tag that is set up appropriately.
    ...and it does work if I stop the code thru the use of an alert(see the included
    code)

    and no, at this point i have not coded for anything other than IE

    thanks for trying
    Jason






    "Luke" <lukecampbell@lycos.com> wrote:
    >
    >You probably need to make sure that there's an entry in the style sheet

    for
    >this item, or else you're code won't work. Something like this in the
    >style sheet would work:
    >
    >#DataPanel { position: absolute; visibility: hidden; }
    >
    >would do the job. Otherwise the browser doesn't know about it's
    >style attributes.
    >
    >..and I'm presuming that you're only supporting IE from the code you've
    >noted!
    >
    >-Luke-
    >
    >"Jason" <jlmacmac@nscorp.com> wrote:
    >>
    >>I am attempting to hide a data panel on my screen and show a wait panel

    >while
    >>extensive jscript edits are running. The script is not processing in order,
    >>and the code that sets the visible/hidden properties to the divs is being
    >>skipped unless I include an alert after the code to hide/show the panels.
    >>Could someone tell me why the code for the panels is not being executed

    >before
    >>the function continues.
    >>
    >>Here is some of my code....
    >>
    >>function chkUpdateInit(x, e)
    >>{
    >>
    >>if (document.all)
    >>{
    >>
    >>
    >>parent.frames[1].document.all["DataPanel"].style.position = "absolute";
    >>parent.frames[1].document.all["DataPanel"].style.visibility = "hidden";
    >>parent.frames[1].document.all["WaitPanel"].top = e.y;
    >>parent.frames[1].document.all["WaitPanel"].style.visibility = "visible";
    >>alert("in the panels");
    >>
    >>//putting the alert in is the only way I have been able to get the code

    >for
    >>the panels to execute before the function below
    >>
    >>
    >>}
    >>
    >>
    >>
    >>chkUpdate(x);
    >>
    >>}
    >>
    >>
    >>function chkUpdate(x)
    >>
    >>{
    >> ........
    >>

    >



  5. #5
    Michael Foster Guest

    Re: manipulating divs on the fly

    > parent.frames[1].document.all["DataPanel"].style.position = "absolute";

    On a side note, you know you can't dynamically change the 'position'
    property, right? It has to be set 'absolute' in the style sheet.



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