ext button 问题 ext 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 $('#slbutton').on('click',function(){$(this).css({background:red;});$(this).text('ab');});//done 本帖最后由 showbo 于 2014-02-14 10:16:46 编辑 您是在html中写的吧?我如果在js中运用了ext,将样式设置在css文件中,那js中如何使用css呢?附上我的一小段js代码:configs = { text: '矢量图', width: 50, id: 'slButton' }; vectorButton = Ext.create('Ext.Button', configs); vectorButton.on("click", vectorButton_click_handler); function vectorButton_click_handler(item, e, options) {。。}在vectorButton_click_handler如何添加上样式,从而每次点击时就使用这个样式? 一样的。导入css文件就行了你的css或者js放到独立的文件中或者直接放到html中都不会影响结果 1、js文件中导入css文件怎么写?2、函数中有如何调用它呢?我是这样写的:function include_css(path) { var fileref = document.createElement("link") fileref.rel = "stylesheet"; fileref.type = "text/css"; fileref.href = path;}function InitializePage(){ configs = { text: '矢量图', width: 50, id: 'slButton' }; vectorButton = Ext.create('Ext.Button', configs); vectorButton.on("click", vectorButton_click_handler); function vectorButton_click_handler(item, e, options) { include_css("../Index/css/myminu.css"); Ext.getCmp('slButton').setIconCls('buttondesinger'); //在../Index/css/myminu.css文件中 }../Index/css/myminu.css文件.buttondesinger { width:50; background-color:#000000; text-align:left; } 您看看这样对吗? function include_css(path) { var fileref = document.createElement("link") fileref.rel = "stylesheet"; fileref.type = "text/css"; fileref.href = path;document.getElementsByTagName('head')[0].appendChild(fileref);/////}include_css("../Index/css/myminu.css");function InitializePage(){ configs = { text: '矢量图', width: 50, id: 'slButton' }; vectorButton = Ext.create('Ext.Button', configs); vectorButton.on("click", vectorButton_click_handler); function vectorButton_click_handler(item, e, options) { Ext.getCmp('slButton').setIconCls('buttondesinger'); //在../Index/css/myminu.css文件中 }不要在事件中导入,直接导入要不因为css要加载,你的代码第一次可能看不到效果什么的 pagingToolbar求高手 hookee 回复于:2009-09-30 的新问题! js传值碰到麻烦了 关于java.lang.IllegalArgumentException: Cannot convert value of type [java.lang.String] to required type [javax.sql.DataSource] 请教CSDN留言板里图片上传的实现 分不够,另给!这要能解决,最高给500分 奇怪的问题,大虾帮忙看看 切换城市问题 JAVA连接SQL2000数据库问题,操作系统XP 圆点移动 几行代码请助? BMap.Convertor.translate多次调用后,内存增加! 无法设置basics的值:对象为null或未定义
$('#slbutton').on('click',function(){
$(this).css({background:red;});
$(this).text('ab');
});
//done
我如果在js中运用了ext,将样式设置在css文件中,那js中如何使用css呢?
附上我的一小段js代码:configs = { text: '矢量图', width: 50, id: 'slButton' };
vectorButton = Ext.create('Ext.Button', configs);
vectorButton.on("click", vectorButton_click_handler); function vectorButton_click_handler(item, e, options) {
。。
}在vectorButton_click_handler如何添加上样式,从而每次点击时就使用这个样式?
2、函数中有如何调用它呢?我是这样写的:function include_css(path) {
var fileref = document.createElement("link")
fileref.rel = "stylesheet";
fileref.type = "text/css";
fileref.href = path;
}
function InitializePage()
{
configs = { text: '矢量图', width: 50, id: 'slButton' };
vectorButton = Ext.create('Ext.Button', configs);
vectorButton.on("click", vectorButton_click_handler);
function vectorButton_click_handler(item, e, options) {
include_css("../Index/css/myminu.css");
Ext.getCmp('slButton').setIconCls('buttondesinger'); //在../Index/css/myminu.css文件中
}
../Index/css/myminu.css文件
.buttondesinger
{
width:50;
background-color:#000000;
text-align:left;
}
您看看这样对吗?
var fileref = document.createElement("link")
fileref.rel = "stylesheet";
fileref.type = "text/css";
fileref.href = path;
document.getElementsByTagName('head')[0].appendChild(fileref);/////
}
include_css("../Index/css/myminu.css");
function InitializePage()
{
configs = { text: '矢量图', width: 50, id: 'slButton' };
vectorButton = Ext.create('Ext.Button', configs);
vectorButton.on("click", vectorButton_click_handler);
function vectorButton_click_handler(item, e, options) {
Ext.getCmp('slButton').setIconCls('buttondesinger'); //在../Index/css/myminu.css文件中
}
不要在事件中导入,直接导入要不因为css要加载,你的代码第一次可能看不到效果什么的