ExtJs之Ext.apply

<!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>
 
    <script type="text/javascript">
			Ext.onReady(function(){
        var panel = new Ext.Panel({
          title: 'SAMPLE',
          renderTo: 'sub1',
          width: '300px',
          html: '<div style="height:160px"></div>'
        });
        var tarObj = {}, srcObj;
        srcObj = {};
        srcObj.name = "源对象";
        srcObj.text = "我的文本已经从SRCOBJ中拷贝过来的了";
        srcObj.width = "130px";
        Ext.apply(tarObj, srcObj);
        Ext.Msg.alert("Ext.apply Sample", "tarObj的属性如下:<br>name: "+
        tarObj.name + "<br>text:" + tarObj.text + "<br>width: " + tarObj.width);
      });
    </script>
</head>
<body>
<div id=sub1></div>
</body>
</html>

Published by

风君子

独自遨游何稽首 揭天掀地慰生平

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注