<!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>
![ExtJs之Ext.apply-编程之家 ExtJs之Ext.apply-编程之家](https://img.fengjinwei.com/2020/11/L3Byb3h5L2h0dHAvaW1hZ2VzMjAxNS5jbmJsb2dzLmNvbS9ibG9nLzQ2NTQzOC8yMDE2MDMvNDY1NDM4LTIwMTYwMzIyMjIyOTU1OTQ4LTIxMzM0MDU4NzMucG5n.jpg)