Ext - heart class Element

本文介绍了一个使用Ext JS库操作DOM元素的示例,包括高亮显示元素背景、为元素添加自定义CSS类、居中元素以及设置元素透明度等操作。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

xml 代码
  1. <html>  
  2. <head>  
  3.   
  4. <title>Ext lession 1 - heat class Elementtitle>  
  5. <link rel="stylesheet" type="text/css" href="http://www.agideo.com/lib/ext-1.0-alpha3/resources/css/ext-all.css"/>  
  6. <link rel="stylesheet" type="text/css" href="http://www.agideo.com/lib/ext-1.0-alpha3/resources/css/ytheme-aero.css" />  
  7. <script type="text/javascript" src="http://www.agideo.com/lib/ext-1.0-alpha3/yui-utilities.js">script>       
  8. <script type="text/javascript" src="http://www.agideo.com/lib/ext-1.0-alpha3/ext-yui-adapter.js">script>        
  9. <script type="text/javascript" src="http://www.agideo.com/lib/ext-1.0-alpha3/ext-all.js">script>  
  10. <style>  
  11.   .red{   
  12.   background-color : red;   
  13. }   
  14. style>  
  15.   
  16. <script>  
  17. function f1()   
  18.     {         
  19.       var myDiv = Ext.get('myDiv');   
  20.       myDiv.highlight();      // The element's background will highlight to yellow then fade back   
  21.     }     
  22.     function f2()   
  23.     {   
  24.       var myDiv = Ext.get('myDiv');   
  25.       myDiv.addClass('red');  // Add a custom CSS class (defined in ExtStart.css)   
  26.     }   
  27.     
  28.     
  29.     function f3()   
  30.     {   
  31.       var myDiv = Ext.get('myDiv');   
  32.       myDiv.center();         // Center the element in the viewport   
  33.     }   
  34.     function f4()   
  35.     {   
  36.       var myDiv = Ext.get('myDiv');   
  37.       myDiv.setOpacity(.25);  // Make the element partially-transparent   
  38.     }   
  39. script>  
  40. head>  
  41. <body>  
  42.   <div id='myDiv'>  
  43.     Lession 1   
  44.   div>  
  45. <input type="button" value="highlight" name="btn" onclick="f1();" />  
  46. <input type="button" value="addClass" name="btn" onclick="f2();" />  
  47. <input type="button" value="center" name="btn" onclick="f3();" />  
  48. <input type="button" value="setOpacity" name="btn" onclick="f4();" />  
  49. body>  
  50. html>  
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值