ExtJs之Ext.util.TextMetrics

时间:2023-03-08 17:00:06
<!DOCTYPE html>
<html>
<head>
    <title>ExtJs</title>
    	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  		<link rel="stylesheet" type="text/css" href="ExtJs/packages/ext-theme-crisp/build/resources/ext-theme-crisp-all.css">
      <script type="text/javascript" src="ExtJs/ext-all.js"></script>
      <script type="text/javascript" src="ExtJs/bootstrap.js"></script>
      <script type="text/javascript" src="ExtJs/packages/ext-theme-crisp/build/ext-theme-crisp.js"></script>
</head>
<body>
<script type="text/javascript">
Ext.onReady(function() {
  var t = new Ext.util.TextMetrics('id01', 5);
  Ext.Msg.alert('notice', '通过getsise取得的文本块的宽度是:' + t.getSize('the text').width);
});
</script>
</body>
<div id='id01' >hello, this fucking word.</div>
</html>

  ExtJs之Ext.util.TextMetrics