EXT--样式表的创建和规则获取示例
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>样式表的创建和规则获取示例</title> <link rel="stylesheet" type="text/css" href="ext-4.2.1/resources/css/ext-all.css" /> <script type="text/javascript" src="ext-4.2.1/bootstrap.js"></script> <script type="text/javascript" src="ext-4.2.1/locale/ext-lang-zh_CN.js"></script> <script type="text/javascript"> Ext.onReady(function(){ var panel=new Ext.Panel({ title:'样式表的创建和规则获取示例', frame:true, renderTo:'test1', width:'300px', html:"<div id='div1' style='width:200px;height:200px;padding:10px;'>"+ "<div id='id01' style='height:20px;'"+ "</div>" }); //通过级联样式表文本规范所述的规则自动创建一个样式表供HTML应用 Ext.util.CSS.createStyleSheet(".myclass{color:blue}","the"); var cssObj=Ext.util.CSS.getRule(".myclass",true);//通过指定的CSS名,查询该CSS规则 Ext.Msg.alert('获取的信息','创建样式表'+'<br>获取myclass样式表中规则的字体颜色:'+cssObj.style.color); }); </script> </head> <body> <div id="test1"></div> </body> </html>
?