Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/75.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何将progressbar嵌入HTML表单?_Html_Forms - Fatal编程技术网

如何将progressbar嵌入HTML表单?

如何将progressbar嵌入HTML表单?,html,forms,Html,Forms,我有下面的代码,希望它显示一个文件上传的表单提交进度。我希望它在我的网站上工作,通过这个IP访问它(24.148.156.217)。因此,如果你看到了网站,我希望在用户填写信息然后点击提交按钮时显示进度条。然后,进度条显示完成之前的时间 <style> <!-- .hide { position:absolute; visibility:hidden; } .show { position:absolute; visibility:visible; } --> &

我有下面的代码,希望它显示一个文件上传的表单提交进度。我希望它在我的网站上工作,通过这个IP访问它(24.148.156.217)。因此,如果你看到了网站,我希望在用户填写信息然后点击提交按钮时显示进度条。然后,进度条显示完成之前的时间

    <style>
<!--
.hide { position:absolute; visibility:hidden; }
.show { position:absolute; visibility:visible; }
-->
</style>

<SCRIPT LANGUAGE="JavaScript">

//Progress Bar script- by Todd King (tking@igpp.ucla.edu)
//Modified by JavaScript Kit for NS6, ability to specify duration
//Visit JavaScript Kit (http://javascriptkit.com) for script

var duration=3 // Specify duration of progress bar in seconds
var _progressWidth = 50; // Display width of progress bar.

var _progressBar = "|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||"
var _progressEnd = 5;
var _progressAt = 0;


// Create and display the progress dialog.
// end: The number of steps to completion
function ProgressCreate(end) {
 // Initialize state variables
 _progressEnd = end;
 _progressAt = 0;

 // Move layer to center of window to show
 if (document.all) { // Internet Explorer
  progress.className = 'show';
  progress.style.left = (document.body.clientWidth/2) - (progress.offsetWidth/2);
  progress.style.top = document.body.scrollTop+(document.body.clientHeight/2) - (progress.offsetHeight/2);
 } else if (document.layers) { // Netscape
  document.progress.visibility = true;
  document.progress.left = (window.innerWidth/2) - 100+"px";
  document.progress.top = pageYOffset+(window.innerHeight/2) - 40+"px";
 } else if (document.getElementById) { // Netscape 6+
  document.getElementById("progress").className = 'show';
  document.getElementById("progress").style.left = (window.innerWidth/2)- 100+"px";
  document.getElementById("progress").style.top = pageYOffset+(window.innerHeight/2) - 40+"px";
 }

 ProgressUpdate(); // Initialize bar
}

// Hide the progress layer
function ProgressDestroy() {
 // Move off screen to hide
 if (document.all) { // Internet Explorer
  progress.className = 'hide';
 } else if (document.layers) { // Netscape
  document.progress.visibility = false;
 } else if (document.getElementById) { // Netscape 6+
  document.getElementById("progress").className = 'hide';
 }
}

// Increment the progress dialog one step
function ProgressStepIt() {
 _progressAt++;
 if(_progressAt > _progressEnd) _progressAt = _progressAt % _progressEnd;
 ProgressUpdate();
}

// Update the progress dialog with the current state
function ProgressUpdate() {
 var n = (_progressWidth / _progressEnd) * _progressAt;
 if (document.all) { // Internet Explorer
  var bar = dialog.bar;
  } else if (document.layers) { // Netscape
  var bar = document.layers["progress"].document.forms["dialog"].bar;
  n = n * 0.55; // characters are larger
 } else if (document.getElementById){
                var bar=document.getElementById("bar")
        }
 var temp = _progressBar.substring(0, n);
 bar.value = temp;
}

// Demonstrate a use of the progress dialog.
function Demo() {
 ProgressCreate(10);
 window.setTimeout("Click()", 100);
}

function Click() {
 if(_progressAt >= _progressEnd) {
  ProgressDestroy();
  return;
 }
 ProgressStepIt();
 window.setTimeout("Click()", (duration-1)*1000/10);
}

function CallJS(jsStr) { //v2.0
  return eval(jsStr)
}

</script>

<SCRIPT LANGUAGE="JavaScript">

// Create layer for progress dialog
document.write("<span id=\"progress\" class=\"hide\">");
 document.write("<FORM name=dialog id=dialog>");
 document.write("<TABLE border=2  bgcolor=\"#FFFFCC\">");
 document.write("<TR><TD ALIGN=\"center\">");
 document.write("Progress<BR>");
 document.write("<input type=text name=\"bar\" id=\"bar\" size=\"" + _progressWidth/2 + "\"");
 if(document.all||document.getElementById)  // Microsoft, NS6
  document.write(" bar.style=\"color:navy;\">");
 else // Netscape
  document.write(">");
 document.write("</TD></TR>");
 document.write("</TABLE>");
 document.write("</FORM>");
document.write("</span>");
ProgressDestroy(); // Hides

</script>


<form name="form1" method="post">
<center>
<input type="button" name="Demo" value="Display progress" onClick="CallJS('Demo()')">
</center>
</form>

<a href="javascript:CallJS('Demo()')">Text link example</a>

//进度条脚本-由Todd King编写(tking@igpp.ucla.edu)
//由NS6的JavaScript工具包修改,能够指定持续时间
//访问JavaScript工具包(http://javascriptkit.com)剧本
var duration=3//以秒为单位指定进度条的持续时间
var _progressWidth=50;//显示进度条的宽度。
本方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方方よよよよよよよよよよよよよよよよよよよよよよよよよよよ
var _progressEnd=5;
var _progressAt=0;
//创建并显示“进度”对话框。
//结束:完成的步骤数
函数ProgressCreate(结束){
//初始化状态变量
_progressEnd=end;
_progressAt=0;
//将图层移动到窗口的中心以显示
如果(document.all){//Internet Explorer
progress.className='show';
progress.style.left=(document.body.clientWidth/2)-(progress.offsetWidth/2);
progress.style.top=document.body.scrollTop+(document.body.clientHeight/2)-(progress.offsetHeight/2);
}else if(document.layers){//Netscape
document.progress.visibility=true;
document.progress.left=(window.innerWidth/2)-100+“px”;
document.progress.top=pageYOffset+(window.innerHeight/2)-40+“px”;
}else if(document.getElementById){//Netscape 6+
document.getElementById(“progress”).className='show';
document.getElementById(“progress”).style.left=(window.innerWidth/2)-100+“px”;
document.getElementById(“progress”).style.top=pageYOffset+(window.innerHeight/2)-40+“px”;
}
ProgressUpdate();//初始化条
}
//隐藏进度层
函数ProgressDestroy(){
//移离屏幕以隐藏
如果(document.all){//Internet Explorer
progress.className='hide';
}else if(document.layers){//Netscape
document.progress.visibility=false;
}else if(document.getElementById){//Netscape 6+
document.getElementById(“progress”).className='hide';
}
}
//将“进度”对话框增加一步
函数ProgressStepIt(){
_progressAt++;
如果(\u progressAt>\u progressEnd)\u progressAt=\u progressAt%\u progressEnd;
ProgressUpdate();
}
//使用当前状态更新“进度”对话框
函数ProgressUpdate(){
变量n=(\u progressWidth/\u progressEnd)*\u progressAt;
如果(document.all){//Internet Explorer
var bar=dialog.bar;
}else if(document.layers){//Netscape
var bar=document.layers[“progress”].document.forms[“dialog”].bar;
n=n*0.55;//字符更大
}else if(document.getElementById){
var bar=document.getElementById(“bar”)
}
变量温度=_progressBar.子字符串(0,n);
巴值=温度;
}
//演示如何使用“进度”对话框。
函数Demo(){
进步创造(10);
setTimeout(“单击()”,100);
}
函数单击(){
如果(\u progressAt>=\u progressEnd){
进行销毁();
回来
}
ProgressStepIt();
设置超时(“单击()”,(持续时间-1)*1000/10);
}
函数CallJS(jsStr){//v2.0
返回评估(jsStr)
}
//“为进度创建图层”对话框
文件。填写(“”);
文件。填写(“”);
文件。填写(“”);
文件。填写(“”);
文件。编写(“进度
”; 文件。填写(“”); else//Netscape 文件。填写(“>”; 文件。填写(“”); 文件。填写(“”); 文件。填写(“”); 文件。填写(“”); ProgressDestroy();//兽皮
JQuery UI具有进度条功能


是一个纯CSS进度条,在包括IE6在内的大多数浏览器上都可以使用。

JQuery UI有一个进度条功能


是一个纯粹的CSS进度条,适用于包括IE6在内的大多数浏览器。

如果使用Flash对您合适,您可以尝试

如果你可以使用Flash,你可以试试

许多大公司现在使用jQuery。。。如果您考虑使用它,JQuery UI中已经有一个进度条了,许多大公司现在都使用jQuery…如果考虑使用它,jQuery UI中已经有一个进度条