0
我試圖顯示一個「加載圖像」,而一些處理髮生在background.Following代碼不會隱藏「加載圖像」,一旦頁面加載。是否有這個代碼有問題?javascript to display loading image
#!/usr/bin/python
# Create instance of FieldStorage
import cgi
import subprocess
import re
import sys
import os
print "Content-type:text/html\r\n\r\n"
print
print "<html>"
print "<head>"
print "<title>Hello - Second CGI Program</title>"
print "</head>"
print '''
<style>
#loading{
width: 50%;
height: 50%;
top: 0;
left: 0;
position: fixed;
display: block;
opacity: 0.7;
background-color: #fff;
z-index: 99;
text-align: center;
}
#loading-image {
position: absolute;
top: 50px;
left: 140px;
z-index: 100;
}
</style>
<body>
<div id="loading">
<img id="loading-image" src='../images/loader.gif' alt='Loading...' />
</div>'''
form = cgi.FieldStorage(){
# Get data from fields
left: 140px;
z-index: 100;
}
</style>
<body>
<div id="loading">
<img id="loading-image" src='../images/loader.gif' alt='Loading...' />
</div>'''
form = cgi.FieldStorage()
# Get data from fields
#caseid=form.getvalue('case',default=None)
#filename=form.getvalue('filename',default=None)
caseid='CASE1'
filename='READ.txt'
pathtofile='/var/www/py_files/'+caseid+'/'+filename
#print('PATH TO FILE'+pathtofile)
destpath='/var/PacketPro/'+caseid+'/'+filename
#print('DEST PATH'+destpath)
#result=filetransfer(pathtofile,destpath)
#print('Result'+str(result))
#sys.exit(0)
#print output
print '''
<h2>Hello </h2>
<script language="javascript" type="text/javascript">
$(window).load(function() {
$('#loading').hide();
});
</script>
</body>
</html>'''
你錯過了一個jQuery的參考? –
ok。我現在加了它。基本上這個腳本是我的html頁面的表單動作腳本。 –
現在工作嗎? –