<script type="text/javascript">
$(function(){
$('.progressBar').each(function(){
var xmlhttp;
var barID = $(this).attr("ID");
if(window.XMLHttpRequest){
xmlhttp=new XMLHttpRequest();
}else{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange = function(){
if (xmlhttp.readyState == 4 && xmlhttp.status == 200){
$(this).css('width', xmlhttp.responseText);
var temp = parseInt(xmlhttp.responseText);
var indicator = temp/19*10 + '%';
$(this).find('span').html(indicator);
}
}
xmlhttp.open("GET","loadWidth.php?id="+barID,true);
xmlhttp.send();
})
}
</script>
$(window).ready(function() {
$("div").each(function(){
fireevent(this);
});
});
This will fire the fireevent function for all divs, passing the current div as a parameter to the function.
jszeto
U can do one another thing for same function.
$(window).bind("load", function() {
fireevent();
});
Note: U must write this function between Javascript tag.
This will load on page startup.