网页加载进度条代码(html加载页面完成进度条效果)
admin 发布:2022-12-19 18:36 199
今天给各位分享网页加载进度条代码的知识,其中也会对html加载页面完成进度条效果进行解释,如果能碰巧解决你现在面临的问题,别忘了关注本站,现在开始吧!
本文目录一览:
php网页加载进度条
不知道你会不会JS,这类问题用PHP是无法实现的,只有用JS来做。一般是设置两个全局变量存放需要装载、已经完成装载的部件数,然后用定时器更新进度显示,例如:
div id=load_stat进度显示/div
script type=text/javascript
var need_load=10;//部件里面使用onload的数量
var load_ok=0;
function show_loading(){
var e=document.getElementById('load_stat');
if (load_okneed_load){
e.innerHTML='共有'+need_load+'个需要装载,已经装载了'+load_ok+'个,完成'+Math.round(load_ok/need_load,2)+'%';
setTimeout("show_loading();",500);//过半秒显示进度
} else e.style.display='none';//关闭进度条
}
setTimeout("show_loading();",500);//过半秒显示进度
/script
img src='...' onload="load_ok++;"
img src='...' onload="load_ok++;"
img src='...' onload="load_ok++;"
img src='...' onload="load_ok++;"
img src='...' onload="load_ok++;"
img src='...' onload="load_ok++;"
img src='...' onload="load_ok++;"
img src='...' onload="load_ok++;"
img src='...' onload="load_ok++;"
img src='...' onload="load_ok++;"
img src='...' onload="load_ok++;"
打开网页时数据进度条的代码
试试这个怎么样?
script language="javascript"
function onSubmit() {
var waitingInfo = document.getElementById(getNetuiTagName("waitingInfo"));
waitingInfo.style.display = ""; //show the ProgressBar
progress_update(); //begin the progressbar
//waiting for several seconds,you would delete in your case
for(i=0;i1000000;i++){
j=i+i;
}
location.href="progressbar.jsp"; //config your action page in here
}
// Build the netui_names table to map the tagId attributes
// to the real id written into the HTML
if (netui_names == null)
var netui_names = new Object();
netui_names.selectButton="portlet_15_1selectButton"
// method which will return a real id for a tagId
function getNetuiTagName(id) {
return netui_names[id];
}
// method which will return a real id for a tagId,
// the tag parameter will be used to find the scopeId for
// containers that may scope their ids
function getNetuiTagName(id, tag) {
var scopeId = getScopeId(tag);
if (scopeId == "")
return netui_names[id];
else
return netui_names[scopeId + "__" + id];
}
// method which get a tag will find any scopeId that,
// was inserted by the containers
function getScopeId(tag) {
if (tag == null)
return "";
if (tag.getAttribute) {
if (tag.getAttribute(´scopeId´) != null)
return tag.getAttribute(´scopeId´);
}
if (tag.scopeId != null)
return tag.scopeId;
return getScopeId(tag.parentNode);
}
// Build the netui_names table to map the tagId attributes
// to the real id written into the HTML
if (netui_names == null)
var netui_names = new Object();
netui_names.waitingInfo="waitingInfo"
var progressEnd = 15; // set to number of progress span´s.
var progressColor = ´green´; // set to progress bar color
var progressInterval = 200; // set to time between updates (milli-seconds)
var progressAt = progressEnd;
var progressTimer;
function progress_clear() {
for (var i = 1; i = progressEnd; i++)
document.getElementById(´progress´+i).style.backgroundColor = ´transparent´;
progressAt = 0;
}
function progress_update() {
progressAt++;
if (progressAt progressEnd) progress_clear();
else document.getElementById(´progress´+progressAt).style.backgroundColor = progressColor;
progressTimer = setTimeout(´progress_update()´,progressInterval);
}
function progress_stop() {
clearTimeout(progressTimer);
progress_clear();
}
/script
span id="waitingInfo" style="display:none"
table align="center"trtd
正在处理数据, 请稍候......
div style="font-size:2pt;padding:2px;border:solid black 1px"
span id="progress1" /span
span id="progress2" /span
span id="progress3" /span
span id="progress4" /span
span id="progress5" /span
span id="progress6" /span
span id="progress7" /span
span id="progress8" /span
span id="progress9" /span
span id="progress10" /span
span id="progress11" /span
span id="progress12" /span
span id="progress13" /span
span id="progress14" /span
span id="progress15" /span
/div
/td/tr/table
/span
center
点击按钮试试:
input name="button" type="button" value="查询" onClick="javascript: return onSubmit();"
/center
android中webview 怎么实现网页加载时显示加载进度
android中只需要给webView注册一个事件即可实现加载进度。
以下是具体实现代码:
1.从webView中获取设置
WebSettings sws = webView.getSettings();
sws.setSupportZoom(true);
sws.setBuiltInZoomControls(true);
webView.setInitialScale(25);
webView.getSettings().setUseWideViewPort(true);
2.注册setWebChromeClient事件
webView.setWebChromeClient(new WebChromeClient() {
public void onProgressChanged(WebView view, int progress) {
// Activity和Webview根据加载程度决定进度条的进度大小
// 当加载到100%的时候 进度条自动消失
//WebViewProgressActivity.this.setTitle("Loading...");
//WebViewProgressActivity.this.setProgress(progress * 100);
if (progress == 100) {
progressBar.setVisibility(View.GONE);
//WebViewProgressActivity.this.setTitle("完成");
}
}
});
3.注意在onProgressChanged中处理进度,progress就是进度值。
网页加载进度条代码的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于html加载页面完成进度条效果、网页加载进度条代码的信息别忘了在本站进行查找喔。
版权说明:如非注明,本站文章均为 AH站长 原创,转载请注明出处和附带本文链接;
相关推荐
- 05-17长沙网站制作公司哪家好,长沙网页制作公司
- 05-17免费建网页,怎样免费建立网站
- 05-17北京百度快照推广公司,百度快照推广有效果吗
- 05-17做公司网页,做公司网页有什么简单的方法
- 05-17百度网页推广,百度网页推广费用
- 05-16百度知道网页版地址,百度知道的网址
- 05-15北京网站建设制作公司,北京网站制作网页
- 05-15如何制作一个网页网站,如何制作一个网页?
- 05-15网络营销推广微信hyhyk1效果好,微信网络营销怎么做
- 05-15在百度上打广告找谁,百度上打广告有效果吗
取消回复欢迎 你 发表评论:
- 标签列表
- 最近发表
- 友情链接