From: Peter B. <pet...@no...> - 2000-11-17 16:34:12
|
Hi all, This little piece of code works fine on everything but IE4+ on Mac and Netscape 6... getWidth() and getHeight() seems to be the problem in both cases. As I'm quite new to the DynAPI I'm very interested in any comments on my way of using it that may cause this problem. This code even works in Netscape 4.05, the browser of horror =) Regards, Peter Bartholdsson <html> <head> <title>Untitled</title> </head> <script language="Javascript" src="/js/dynapi.js"></script> <script language="Javascript"> DynAPI.setLibraryPath('/js/lib/'); DynAPI.include('dynapi.api.dynlayer'); DynAPI.include('dynapi.api.browser'); DynAPI.include('dynapi.api.dyndocument'); DynAPI.onLoad=function() { // browser = new Browser(); pblayer0 = new DynLayer(); pblayer0.setBgColor('#f0f0f0'); pblayer0.moveTo(10, 10); pblayer0.setWidth('300'); this.document.addChild(pblayer0); pblayer0.setHTML('hej hej<br>Bluttan blä på er alla!'); pblayer0.setHeight(pblayer0.getContentHeight()); pblayer1 = new DynLayer(); pblayer1.setBgColor('#c0c0c0'); pblayer1.setHTML('hej hej<br>Bluttan blä på er alla!'); pblayer1.moveTo(pblayer0.getX() + 0, pblayer0.getY() + pblayer0.getHeight() + 10); pblayer1.setWidth(pblayer0.getWidth() + 0); this.document.addChild(pblayer1); pblayer2 = new DynLayer(); pblayer2.setBgColor('#a0a0a0'); pblayer2.setHTML('hej hej<br>Bluttan blä på er alla!'); pblayer2.moveTo(pblayer0.getX() + pblayer0.getWidth() + 10, pblayer0.getY() + 0); pblayer2.setWidth('300'); pblayer2.setHeight(pblayer1.getHeight() + pblayer1.getHeight() + 10); this.document.addChild(pblayer2); pblayer3 = new DynLayer(); pblayer3.setBgColor('#808080'); pblayer3.setHTML('hej hej<br>Bluttan blä på er alla!'); pblayer3.moveTo(pblayer1.getX() + 0, pblayer1.getY() + pblayer1.getHeight() + 10); pblayer3.setWidth(pblayer1.getWidth() + pblayer2.getWidth() + 10); this.document.addChild(pblayer3); } </script> </head> <body> </body> </html> |