JS问题,在网上找的进度条,发现不支持firefox。我修改了一些,但是进度条里面的颜色还是无法显示。

[复制链接]
查看11 | 回复1 | 2011-5-17 04:45:06 | 显示全部楼层 |阅读模式
大家谁帮我看看还有那里不支持firefox
scriptlanguage=\"javascript\"
varcurrentProgress=0;
vartime;
functionbegin(){
        if(currentProgress==100){
                currentProgress=0;
        }
        if(time){
                clearTimeout(time);
        }
        time=window.setTimeout(\"draw()\",100);
}
functiondraw(){
        currentProgress=currentProgress5;
        if(currentProgress95){
                currentProgress=95;
        }
        document.getElementById(\"inner1\").style.width=currentProgress\"%\";
        document.getElementById(\"inner1\").style.visibility=\"visible\";
        document.getElementById(\"testProgressText\").innerHTML=(currentProgress\'%\');
        if(currentProgress==95)
        {
                return;
        }
        window.setTimeout(\"draw()\",500);
}
/script

body
        divid=\"testProgress\"style=\"width:200px;height:12px;border:1pxsolid#999\"
                spanid=\"inner1\"style=\"width:0%;line-height:12px;visibility:hidden;background-color:F4A460;height:12px;\"
                /span
        /div
        divid=\"testProgressText\"style=\"width:50px;height:12px;float:left;\"
        /div
        br
        buttononclick=\"begin()\"TestHere/button
/body
回复

使用道具 举报

千问 | 2011-5-17 04:45:06 | 显示全部楼层
你需要先判断浏览器是否IE系列。不是的话,你可以用这个代码。是的话,你得用ActiveX那一套。

下面这个方法能帮你获取适合浏览器的XmlHttpRequest。

functiongetXMLHttpRequest()
{
varxmlHttpRequest;
if(window.XMLHttpRequest)
{
//alert(\"0\");
xmlHttpRequest=newXMLHttpRequest();
}
else
{
if(window.ActiveXObject)
{
//alert(\"1\");
xmlHttpRequest=newActiveXObject(\"Microsoft.XMLHTTP\");
}
}
returnxmlHttpRequest;
}
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则