Re: SV: Dynamically creating layers in FireFox

Scott Sauyet <[email protected]> Thu, 23 Mar 2006 14:17:11 -0500
Newsgroups gmane.comp.web.dom.wdf
Message-ID <[email protected]>
Kenneth Chr. Nilsen wrote:
> The HTML consist only of plain HTML and a couple of DIVs.
> I use a test button to check:

You don't have units on your dimensions.  Try

          newDiv.style.left = x + 'px';
          newDiv.style.top = y + 'px';
          newDiv.style.width = w + 'px';
          newDiv.style.height = h + 'px';

That should do it.  Everything else looks okay.

   -- Scott


> ---
> <a href="#" onclick="createLayer('layDialog', 'layTesting', 70, 70, 400,
> 300, 100);return false" id="btnCreateLayer">Create layer</a>
> ---
> 
> The function is in it's own .js file. Works as I mentioned with IE and
> Opera, not fault during debugging.
> In FF nothing happends. Here is the function that I use:
> 
> ---
> function createLayer(parentID, layID, x, y, w, h, zIndex)
> {
>     if (document.document.getElementById)      //disabling this check makes
> no difference in FF.
>     {
>         pElement = document.getElementById(parentID);
>         var newDiv = document.createElement("DIV");
> 
>         newDiv.setAttribute('id',layID);
>         newDiv.setAttribute('name',layID);
>         newDiv.style.left = x;
>         newDiv.style.top = y;
>         newDiv.style.width = w;
>         newDiv.style.height = h;
>         newDiv.style.position = 'absolute';
>         newDiv.style.visibility = 'visible';
>         newDiv.style.zIndex = zIndex;
>         newDiv.style.backgroundColor = "#aaaaaa";
>         pElement.appendChild(newDiv);
>     }
>     else ...
>     {
>         ...
>     }
> }



Unsubscribe
[email protected]

List info
http://www.quirksmode.org/dom/list.html 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/wdf-dom/

<*> To unsubscribe from this group, send an email to:
    [email protected]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/