Login Register

jsId not being supported by IE 6.0.

Hi,
I am trying to use the following code snippet to use DOJO progress bar.

<head>
<title>Progress Bar Demo</title>

    <style type="text/css">
       @import "dojo-release-1.1.0/dijit/themes/tundra/tundra.css";
       @import "dojo-release-1.1.0/dojo/resources/dojo.css"
   </style>

    <script type="text/javascript" src="dojo.xd.js"
  djConfig="parseOnLoad: true">
</script>

    <script type="text/javascript">
        dojo.require("dijit.ProgressBar");
        dojo.require("dojo.parser");
        function download() {
            // Split up bar into 5% segments
            numParts = Math.floor(100/5);
            jsProgress.update({ maximum: numParts, progress:0 });
            for (var i=0; i<=numParts; i++){
                // This plays update({progress:0}) at 1nn milliseconds,
                // update({progress:1}) at 2nn milliseconds, etc.
                setTimeout("jsProgress.update({ progress: " + i + " })",(i+1)*100 +
                                Math.floor(Math.random()*100));
            }
        }
     </script>

</head>
Progress Bar:
<body class="tundra">
    <div dojoType="dijit.ProgressBar" style="width:800px"
         jsId="jsProgress" id="downloadProgress">
</div>
    <input type="button" value="Start" onclick="download();" />
</body>

But each time I click on "start" button I get a javascript error mentioning 'jsProgress i undefined'.
The progress bar doesnot appear at all.Help plz...

Use dijit.byId.

as in:

var jsProgress = dijit.byId("downloadProgress");

"dijit" is undefined

Hi I am using the following:

var jsProgress = dijit.byId("downloadProgress");

I am getting another javascript error-- "'dijit' is undefined". Plz help..

its actually the quotes in

its actually the quotes in your setTimout....

try

var delay = (i+1) * 100 + Mat.floor(Math.random()*100);
setTimeout(dojo.hitch(jsProgress,"update", { progress:i }), delay);