Non-wrappable / wrappable label based on Layer : Label « Ajax Layer « JavaScript DHTML






Non-wrappable / wrappable label based on Layer


http://dynapi.sourceforge.net/
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
<html>
<head>
<title>DynAPI Examples - Label</title>
<script language="JavaScript" src="./dynapisrc/dynapi.js"></script>
<script language="JavaScript">
dynapi.library.setPath('./dynapisrc/')
dynapi.library.include('dynapi.api')
dynapi.library.include('dynapi.gui.Label')
</script>
<script language="JavaScript">
  label1 = new Label('');
  label1.setText('this is a padded wrappable label');
  label1.setWrap(true);
  label1.setLocation(350,20)
  label1.setBgColor('yellow')
  label1.setPadding(5)
  label1.setWidth(100)
  label1.packHeight()
  dynapi.document.addChild(label1)

  label2 = new Label()
  label2.setText('this is a non-selectable wrappable label')
  label2.setWrap(true)
  label2.setLocation(350,110)
  label2.setBgColor('yellow')
  label2.setWidth(100)
  label2.packHeight()
  label2.setSelectable(false)
  dynapi.document.addChild(label2)

  label3 = new Label('this is a padded non-wrappable label')
  label3.setLocation(350,220)
  label3.setBgColor('yellow')
  label3.setPadding(8)
  label3.pack()
  dynapi.document.addChild(label3)

  label4 = new Label('this is a non-selectable non-wrappable label')
  label4.setLocation(350,280)
  label4.setBgColor('yellow')
  label4.pack()
  label4.setSelectable(false)
  dynapi.document.addChild(label4)

//-->
</script>
</head>
<body bgcolor="#ffffff">
<script language="JavaScript">
    dynapi.document.insertAllChildren();
</script>
Resize:
<br>wrappable label: <a href="javascript:label1.setWidth(100)">100</a>, <a href="javascript:label1.setWidth(170)">170</a>
<br>wrappable label with cover: <a href="javascript:label2.setWidth(80)">80</a>, <a href="javascript:label2.setWidth(150)">150</a>
<br>non-wrappable label: <a href="javascript:label3.setWidth(80)">80</a>, <a href="javascript:label3.setWidth(150)">150</a>
<br>non-wrappable label with cover: <a href="javascript:label4.setWidth(80)">80</a>

</body>
</html>

           
       








dynapi.zip( 791 k)

Related examples in the same category