我有上传表单,允许用户上传多个文件.如果文件非常大,我决定进度条会很好.以下是我的源代码.我是jquery的新手通常我只是php但我发现ajax更加用户友好.
<div id="new_upload">
<div class="close_btn"></div>
<div id="uploads"></div>
<form action="global.func/file_upload.php" method="post" enctype="multipart/form-data" id="upload_file">
<fieldset><legend>Upload an image or video</legend>
<input type="file" id="file" name="file[]" placeholder="Upload Image or Video" multiple /><input type="submit" value="upload file" id="upload_file_btn" required />
</fieldset>
<div class="bar">
<div class="bar_fill" id="pb">
<div class="bar_fill_text" id="pt"></div>
</div>
</div>
</form>
</div>
<script>
function OnProgress(event, position, total, percentComplete){
//Progress bar
console.log(total);
$('#pb').width(percentComplete + '%') //update progressbar percent complete
$('#pt').html(percentComplete + '%'); //update status text
}
function beforeSubmit(){
console.log('ajax start');
}
function afterSuccess(data){
console.log(data);
}
$(document).ready(function(e) { …Run Code Online (Sandbox Code Playgroud) 我对Android开发很新,我知道基本活动,地图,sqlite等.我希望能够实现一些3D对象,以便能够在我的应用程序中进行交互.经过一番搜索,我发现rajawali似乎是最好的方法.正如您所做的那样,我从第一篇教程开始,并从示例文档中读取源代码.我迷失的地方是我逐字逐句地遵循了教程,由于脚本中的错误,我无法运行应用程序.如果有人使用Rajawali之前我会指出一些关于我哪里出错的指示.(该教程最后更新于2个月前,因此它最近更新).教程
这是我的源代码
主要活动:
package rajawali.tutorials;
import rajawali.RajawaliActivity;
import android.os.Bundle;
import android.view.Menu;
public class MainActivity extends RajawaliActivity {
private Renderer mRenderer;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mRenderer = new Renderer(this);
mRenderer.setSurfaceView(mSurfaceView);
super.setRenderer(mRenderer);
}
}
Run Code Online (Sandbox Code Playgroud)
渲染:
package rajawali.tutorials;
import javax.microedition.khronos.opengles.GL10;
import android.content.Context;
import rajawali.lights.DirectionalLight;
import rajawali.materials.textures.ATexture.TextureException;
import rajawali.materials.textures.Texture;
import rajawali.primitives.Sphere;
import rajawali.renderer.RajawaliRenderer;
public class Renderer extends RajawaliRenderer {
private DirectionalLight mLight;
Sphere mSphere;
public Renderer(Context context) {
super(context);
setFrameRate(60);
}
public void initScene() {
mLight = new DirectionalLight(1f, 0.2f, -1.0f); …Run Code Online (Sandbox Code Playgroud) 我有一个正在构建的表单 - 与任何其他表单完全相同.但是,一如既往,有一个错误:
Uncaught SyntaxError: Unexpected identifier
Run Code Online (Sandbox Code Playgroud)
以下是错误引用的脚本部分:
alert( $('#email_err').html() );
if ( checkEmail( $('#email').val() ) {
$('#email_err').html(''); //the error refers to this line
} else {
$('#email_err').html('That email address appears to be invalid');
count++;
}
Run Code Online (Sandbox Code Playgroud)
所以我的问题是alert( $('#email_err').html() );和之间的区别是什么$('#email_err').html('');?他们显然是一样的.可能有一些我忽略的东西,但我的形式的其余部分使用相同的方法完美地工作.
如果它有助于继承人的全部功能:
$(document).ready(function (e) {
$('#reg').on('submit', function (e) {
var count = 0;
e.preventDefault();
alert( $('#email_err').html() );
if ( checkEmail( $('#email').val() ) {
$('#email_err').html('');
} else {
$('#email_err').html('That email address appears to be invalid');
count++;
}
if ( …Run Code Online (Sandbox Code Playgroud)