zoukankan      html  css  js  c++  java
  • 转::Ext.getCmp()应用

    html] view plaincopy

      1. 1.<%@page contentType="text/html" pageEncoding="UTF-8"%>     
      2. 2.<%     
      3. 3.            request.setAttribute("base", request.getContextPath());     
      4. 4.%>     
      5. 5.    
      6. 6.<html>     
      7. 7.    <head>     
      8. 8.        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">     
      9. 9.        <title>getCmp方法的简单应用</title>     
      10. 10.        <link rel="stylesheet" type="text/css" href="${base}/ext/resources/css/ext-all.css" />     
      11. 11.        <script type="text/javascript" src="${base}/ext/ext-base.js"></script>     
      12. 12.        <script type="text/javascript" src="${base}/ext/ext-all.js"></script>     
      13. 13.        <script type="text/javascript" src="${base}/ext/ext-lang-zh_CN.js"></script><!--中文映射-->     
      14. 14.    
      15. 15.        <script type="text/javascript">     
      16. 16.                
      17. 17.            function ready(){     
      18. 18.                var setText=function(){//重新设置文本函数     
      19. 19.                    var button=Ext.getCmp("btn");//根据id获取按钮对象     
      20. 20.                    var btnId=button.id;//获取按钮id     
      21. 21.                    var btnText=button.text;//获取按钮文本     
      22. 22.                    var btnType=button.type;//获取按钮类型     
      23. 23.                    var result="id:"+btnId+"  文本:"+btnText+" 类型:"+btnType;     
      24. 24.                    Ext.Msg.alert("",result);//提示框     
      25. 25.                    Ext.getCmp("btn").setText("取消");//根据id获取对象,重新设置文本     
      26. 26.                }     
      27. 27.                var alertBtn=new Ext.Button({//定义按钮对象     
      28. 28.                    id:"btn",//按钮id     
      29. 29.                    text:"确定",//按钮显示的文本     
      30. 30.                    handler:setText,//定义按钮触发的事件,直接可以写成函数名     
      31. 31.                    renderTo:document.body//将按钮渲染到窗体上     
      32. 32.                });     
      33. 33.            }     
      34. 34.            Ext.onReady(ready) ;//参数为定义的函数,onReady是程序的入口     
      35. 35.        </script>     
      36. 36.    </head>     
      37. 37.    <body>     
      38. 38.    
      39. 39.    </body>     
      40. 40.</html>    
      41. <%@page contentType="text/html" pageEncoding="UTF-8"%>  
      42. <%  
      43.             request.setAttribute("base", request.getContextPath());  
      44. %>  
      45.   
      46. <html>  
      47.     <head>  
      48.         <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">  
      49.         <title>getCmp方法的简单应用</title>  
      50.         <link rel="stylesheet" type="text/css" href="${base}/ext/resources/css/ext-all.css" />  
      51.         <script type="text/javascript" src="${base}/ext/ext-base.js"></script>  
      52.         <script type="text/javascript" src="${base}/ext/ext-all.js"></script>  
      53.         <script type="text/javascript" src="${base}/ext/ext-lang-zh_CN.js"></script><!--中文映射-->  
      54.   
      55.         <script type="text/javascript">  
      56.              
      57.             function ready(){  
      58.                 var setText=function(){//重新设置文本函数  
      59.                     var button=Ext.getCmp("btn");//根据id获取按钮对象  
      60.                     var btnId=button.id;//获取按钮id  
      61.                     var btnText=button.text;//获取按钮文本  
      62.                     var btnType=button.type;//获取按钮类型  
      63.                     var result="id:"+btnId+"  文本:"+btnText+" 类型:"+btnType;  
      64.                     Ext.Msg.alert("",result);//提示框  
      65.                     Ext.getCmp("btn").setText("取消");//根据id获取对象,重新设置文本  
      66.                 }  
      67.                 var alertBtn=new Ext.Button({//定义按钮对象  
      68.                     id:"btn",//按钮id  
      69.                     text:"确定",//按钮显示的文本  
      70.                     handler:setText,//定义按钮触发的事件,直接可以写成函数名  
      71.                     renderTo:document.body//将按钮渲染到窗体上  
      72.                 });  
      73.             }  
      74.             Ext.onReady(ready) ;//参数为定义的函数,onReady是程序的入口  
      75.         </script>  
      76.     </head>  
      77.     <body>  
      78.   
      79.     </body>  
      80. </html>  
      81.    
      82.   
      83.    
      84.   
      85. 其他的比如  Ext.get("一个参数");Ext.getDom("一个参数");Ext.getDoc("不带参数");  
      86. 就不详细介绍了。  
      87.  
  • 相关阅读:
    [CodeForces]Codeforces Round #429 (Div. 2) ABC(待补)
    About Me
    2018-06-14
    Codeforces Codeforces Round #484 (Div. 2) E. Billiard
    Codeforces Codeforces Round #484 (Div. 2) D. Shark
    Codeforces Educational Codeforces Round 44 (Rated for Div. 2) F. Isomorphic Strings
    Codeforces Educational Codeforces Round 44 (Rated for Div. 2) E. Pencils and Boxes
    Codeforces Avito Code Challenge 2018 D. Bookshelves
    Codeforces Round #485 (Div. 2) D. Fair
    Codeforces Round #485 (Div. 2) F. AND Graph
  • 原文地址:https://www.cnblogs.com/myitmylife/p/3591705.html
Copyright © 2011-2022 走看看