日期:2014-05-16  浏览次数:20398 次

如何设置控件的disable状态下的样式使其看起来和enable的状态一样
同题

------解决方案--------------------
把控制的样式设置为enable的样式

------解决方案--------------------
HTML code

<!DOCTYPE HTML>
<html>
    <head>
        <meta charset="gb2312" />
        <title></title>
        <style>
            .test {
                border:1px solid red;
                background:#fff;
                color:green;
            }
        </style>
    </head>
    <body>
        <input class="test" value="我是可操作的"  />
        <input class="test" disabled="disabled" value="我是不可操作的" />
        <pre>
            ps: disabled 在ie下不能设置文本颜色,而在ff下可以。
            一定要改变颜色
            则可以使用readonly
        </pre>
        <input class="test" value="我是可操作的"  />
        <input class="test" readonly="readonly" value="我是只读的" />        
    </body>
</html>

------解决方案--------------------
/* //////////// ==== public methods ==== //////////// */
return {
/* ==== initialize script ==== */
create : function (div, size, zoom, border) {
/* ---- instanciate imageFlow ---- */
var load = function () {
var loaded = false;
var i = instances.length;
while (i--) if (instances[i].oCont == div) loaded = true;
if (!loaded) {
/* ---- push new imageFlow instance ---- */
instances.push(
new ImageFlow(div, size, zoom, border)
);
/* ---- init script (once) ---- */
if (!imf.initialized) {
imf.initialized = true;
/* ---- window resize event ---- */
addEvent(window, 'resize', function () {
var i = instances.length;
while (i--) instances[i].resize();
});
/* ---- stop drag N drop ---- */
addEvent(document.getElementById(div), 'mouseout', function (e) {
if (!e) e = window.event;
var tg = e.relatedTarget || e.toElement;
if (tg && tg.tagName == 'HTML') {
var i = instances.length;
while (i--) instances[i].oc.onmousemove = null;
}
return false;
});
/* ---- set interval loop ---- */
setInterval(function () {
var i = instances.length;
while (i--) instances[i].run();
}, 16);
}
}
}
/* ---- window onload event ---- */
addEvent(window, 'load', function () { load(); });
}
}
}();

/* ==== create imageFlow ==== */
// div ID , size, zoom, border
imf.create("imageFlow", 0.1, -1, 5);

</script>