Ok, here I go rescuing :)

main=this.document.all['maindiv']                // This is IE only
main=this.document.getAll()['maindiv']        // This is DynAPI syntax


DynAPI.document.addChild(main);            // By doing this, you are adding to a 
document a layer that's already there. This will cause the original to be deleted.
                                                                 // If you wanted to 
add the layer to the array of children, you don't need to. It's already there.


And most important, in NS relative DIVs do not exist as layers and thus can't be 
accessed by the inline extension, unless you specifically set its style property
to relative. I know it sound pretty stupid, as relative is the default value, but it 
is the way it is:

<div id="maindiv" style="position:relative">

Must have posted this one a hundred times :)

Cya.


xmypoe wrote:

> hello. okay, i give up :) stuck up into code and cannot figure out
> what's what and where's where.
> any ideas ?
>
> here is the listing:
>
> <!-- start of listing -->
>
> <html>
> <head>
> <title>dynapi 2 layers/images</title>
> <script language="Javascript" src="j/dynapi.js"></script>
> <script language="Javascript">
> DynAPI.setLibraryPath('j/lib/')
> DynAPI.include('dynapi.api.*')
> DynAPI.include('dynapi.event.*')
> DynAPI.include('dynapi.ext.inline.js')
> DynAPI.include('dynapi.gui.loadpanel.js');
> DynAPI.include('dynapi.gui.dynimage.js');
> </script>
> <script language="Javascript">
>
> DynAPI.onLoad=function()
>       {
>
>        m1 = DynImage.getImage('i/m-bar.gif');
>            m1_ = DynImage.getImage('i/m-bar_.gif');
>
>            var layerone = this.document.getAll()['layerone']
>            layerone.setVisible(false)
>            var layertwo = this.document.getAll()['layertwo']
>            layertwo.setVisible(false)
>
>        layerthree=new LoadPanel();
>        layerthree.setHTML("no file");
>        layerthree.setSize(77,200)
>        layerthree.setBgColor('green');
>        layerthree.moveTo(311,18);
>        layerthree.setVisible(true)
>
>        main=this.document.all['maindiv']
>
>        DynAPI.document.addChild(layerthree);
>        DynAPI.document.addChild(main);
>       }
>
> function setone()
>          {
>           DynAPI.document.all['layerone'].setVisible(true)
>           DynAPI.document.all['layertwo'].setVisible(false)
>          }
>
> function settwo()
>          {
>           DynAPI.document.all['layerone'].setVisible(false)
>           DynAPI.document.all['layertwo'].setVisible(true)
>          }
>
> function loadthree()
>          {
>           layerthree.setURL('external.html')
>          }
>
> </script>
> </head>
>
> <body bgcolor="#ffffff" leftmargin="0" topmargin="0" marginwidth="0" 
>marginheight="0">
> <div id="layerone" style="position:absolute; left:7px; top:226px; width:129px; 
>height:181px; z-index:1; background: #006699; layer-background-color: #006699"><a 
>href="javascript:alert('clicked')" 
>onmouseover="layerone.doc.images['imaaj2'].src='i/m-bar_.gif'" 
>onmouseout="layerone.doc.images['imaaj2'].src='i/m-bar.gif'"><img src="i/m-bar.gif" 
>border=0 name=imaaj2></a></div>
> <div id="layertwo" style="position:absolute; left:155px; top:227px; width:129px; 
>height:181px; z-index:2; background: #CC0099; layer-background-color: #CC0099"></div>
> <div id="maindiv">
> <table width="300" border="0" cellspacing="0" cellpadding="0" height="200" 
>name="table1">
>   <tr>
>     <td bgcolor="#FFFF99" align="center" valign="middle">
>       <a href="javascript:setone()">one</a><br>
>       <a href="javascript:settwo()">two</a><br>
>       <a href="javascript:loadthree()">three</a><br><br>
>       <a href="javascript:alert('clicked')" 
>onmouseover="main.doc.images['imaaj1'].src='i/m-bar_.gif'" 
>onmouseout="main.doc.images['imaaj1'].src='i/m-bar.gif'"><img src="i/m-bar.gif" 
>border=0 name=imaaj1></a></td>
>   </tr>
> </table>
> </div>
> </body>
> </html>
>
> <!-- end of listing -->
>
> the 'i/something' images are just normal/highlighted pair o'images.
> the code layout is just as i want - two inline layers and the third
> one which is external. images are INLINE (that's my aim, actually).
>
> 1) the code for loading/switching layers works perfectly - everything
> is allright
> 2) the code for image swapping... help me out here, please.
> a) the code for main is okay in MSIE (mine is 5), but it errors-out in
> netscape 4.7
> b) the code inside the layerone errors-out in both browsers. any ideas
> ?
>
> non-inline images are NOT the option for me. event handlers are NOT
> the options for me - i want to keep the code small and clean - on my
> page i gonna have TONS of images, so you can imagine the resulting
> filesize and, more importantly, its readability :)
>
> any better ideas ? any corrections ?
>
> peace,
> x.
>
> http://xmypoe.com
>
> _______________________________________________
> Dynapi-Help mailing list
> [EMAIL PROTECTED]
> http://lists.sourceforge.net/lists/listinfo/dynapi-help


_______________________________________________
Dynapi-Help mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/dynapi-help

Reply via email to