Ten z digital bush coś mi nie działa. Na 100% coś źle robie. Możecie napisać jak to ma być. Nie piszcie o kursach bo właśnie czytam 1, ale dalej mi nie idzie.
W ogóle jak to podpiąć pod upload?
PS: Do modratora, chyba trzeba przenieść bo temat zszedł na js.
Dobra mam coś takiego:
<link rel="stylesheet" type="text/css" href="style.progressbar.css" /> var interval;
var procents = 0;
var rands = 0;
var procen = 0;
function cut() {
obj = document.getElementById("mask");
text = document.getElementById("procents");
width = obj.offsetWidth;
rands = rand(15);
width = width - rands;
procents += Math.round(rands/3);
obj.style.width = width + "px";
if(procents >= 100) {
clearInterval(interval);
procents = 100;
}
text.innerHTML = "
<b>"+procents + "%
</b>";
}
function startUpload() {
document.getElementById("upload_process").style.display = "block";
interval = setInterval("cut()", rand(300));
return true;
}
function stopUpload() {
clearInterval(interval);
}
function rand(n) {
return (Math.round(Math.random() * n + 1));
}
<form method="post" enctype="multipart/form-data" target="upload_target" onsubmit="startUpload();"> File:
<input name="myfile" type="file" /><input type="submit" name="plik" value="Upload"/> <div id="upload_process" style="display:none;"> <iframe id="upload_target" name="upload_target" src="#" style="width:0px;height:0px;border:0px solid #fff;"></iframe>
Tylko jak to podpiąć żeby szło równo z uploadowaniem?