首页 > 代码库 > extjs4_msg
extjs4_msg
经过一早上的努力,终于成功显示了ext.msg.alert("somestring")!一个漂亮的对话框,呵呵
真的是感想挺多,收获也很多的。主要是:
一、用Wamp在win7下搭建好了运行网页的环境;
二、按照别人提供好的方法,做好了EclipseForPHP+spekt+Extjs4.0的工具及环境;(具体链接在我的blog下可以找到)
三、打开了extjs的api文档,再参照着extjs提供的示例中msgbox相关部分,可以改变对话框的样式;
四、注意在html引入文件所需要的路径以及.js文件中当函数体结束时不要忘了打“;”号;
以下是两个文件的代码:主要是引入文件时的路径把我的时间浪费了不少
helloworld.js:
Ext.onReady(function(){ Ext.get(‘btn1‘).on(‘click‘,function(e){ //Ext.Msg.alert("hello world!"); //显示的是标准的对话框 /*Ext.Msg.prompt(‘Name‘, ‘Please enter your name:‘, function(btn, text){ if (btn == ‘ok‘){ // process text value and close... }});*/Ext.Msg.show({ title:‘Save Changes?‘, msg: ‘You are closing a tab that has unsaved changes. Would you like to save your changes?‘, buttons: Ext.Msg.YESNOCANCEL, icon: Ext.Msg.QUESTION}); }); });
index.html:
<!DOCTYPE html><html><head><meta charset="UTF-8"><title>程序界面</title><link rel="stylesheet" type="text/css" href="http://www.mamicode.com/ext4/resources/css/ext-all.css"> <script type="text/javascript" src="http://www.mamicode.com/ext4/bootstrap.js"></script><script type="text/javascript" src="http://www.mamicode.com/ext4/locale/ext-lang-zh_CN.js"></script><script type="text/javascript" src="http://www.mamicode.com/helloworld.js"></script></head><body><button id="btn1">show a message</button></body></html>
*************************************************************
在使用eclipse编辑好.js文件后,若要想显示中文,一定是要在preferences->General->workspaced页面把"Text file encoding"项改成"utf-8"格式。
extjs4_msg
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。