Set layer width and height : Layer Resize Move : Ajax Layer JAVASCRIPT DHTML TUTORIALS


JAVASCRIPT DHTML TUTORIALS » Ajax Layer » Layer Resize Move »

 

Set layer width and height




http://dynapi.sourceforge.net/
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999       
<html>
<head>
<title>Content Width/Height Test</title>
<script language="JavaScript" src="./dynapisrc/dynapi.js"></script>
<script language="Javascript">
dynapi.library.setPath('./dynapisrc/');
dynapi.library.include('dynapi.api');
</script>
<script>
var lyr=dynapi.document.addChild(new DynLayer(null,200,100,200,200,'yellow'));

function getWH(){
  var w,h,f=document.forms['frm'];
  f.lw.value=w=lyr.getWidth();
  f.lh.value=h=lyr.getHeight();
  lyr.setSize(1,1);
  f.cw.value=lyr.getContentWidth();
  f.ch.value=lyr.getContentHeight();
  lyr.setSize(w,h);

}

function content1(){
  var t='<table border="1" width="60" height="100"><tr><td>Table #1 60x100</td></tr></table>';
  lyr.setHTML(t);
  getWH();
}

function content2(){
  var t='<table border="1" width="80" height="150"><tr><td>content #2 80x150</td></tr></table>';
  lyr.setHTML(t);
  getWH();
}
</script>
</head>
<body>
<script>
  dynapi.document.insertAllChildren();
</script>
<form name="frm">
Layer Width:<input type="text" name="lw" size="5">
Layer Height:<input type="text" name="lh" size="5"><br>
Layer Content Width:<input type="text" name="cw" size="5">
Layer Content Height:<input type="text" name="ch" size="5">
<p><a href="javascript:content1();">Set Content 1</a><br>
<a href="javascript:content2();">Set Content 2</a></p>
</body>
</html>


           
       

Download : Download nav_dynapi.zip nav_dynapi.zip


-

Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .

Follow Navioo On Twitter

JAVASCRIPT DHTML TUTORIALS

 Navioo Ajax Layer
» Layer Resize Move