如果用过uploadify上传插件的达人可能更知道我干什么反正就是上传图片 并生成缩略图 但是传入的宽度高度总是初始值看代码吧 我都注释了
<script type="text/javascript" src="/e/extend/talent/upload/jquery.min.js"></script>
<script type="text/javascript" src="/e/extend/talent/upload/jquery.uploadify-3.1.js"></script>
<link rel="stylesheet" type="text/css" href="/e/extend/talent/upload/uploadify.css">
<script>
$(function() {
var imgwidth=$("#width").val(); //定义变量 获取宽度
var imgheight=$("#height").val(); //定义变量 获取高度
//宽高都有初始值,当用户改变值时重新赋值变量
$("#width").change( function() {
imgwidth=$("#width").val();
alert(imgwidth); //这里alert出来的这个变量的值是对的,的确是改变后的
}); $("#file_upload_1").uploadify({
method : 'post',
//下面传参数,经测试传进去的还是宽高两个input的初始值而非用户改变后的
formData : {'type' : 1, 'classid' : <?=$classid?>, 'filepass' : <?=$filepass?> , 'doing' : 1, 'field' : 'titlepic', 'getsmall' : 1, 'width' : imgwidth, 'height' : imgheight},
height : 30,
swf : '/e/extend/talent/upload/uploadify.swf',
uploader : '/e/extend/talent/upload/up.php',
width : 120,
onUploadSuccess : function(file, data, response) {
alert(imgwidth); //走到这里alert出来的值也是改变后的,但上面传进去的说什么都是初始的
alert(data);
$("#picurl").val(data);
}
});
});
</script>
<input type="file" name="file_upload" id="file_upload_1" />
宽度 <input name="width" type="text" id="width" value="105" size="6">
高度 <input name="height" type="text" id="height" value="118" size="6">
<script type="text/javascript" src="/e/extend/talent/upload/jquery.min.js"></script>
<script type="text/javascript" src="/e/extend/talent/upload/jquery.uploadify-3.1.js"></script>
<link rel="stylesheet" type="text/css" href="/e/extend/talent/upload/uploadify.css">
<script>
$(function() {
var imgwidth=$("#width").val(); //定义变量 获取宽度
var imgheight=$("#height").val(); //定义变量 获取高度
//宽高都有初始值,当用户改变值时重新赋值变量
$("#width").change( function() {
imgwidth=$("#width").val();
alert(imgwidth); //这里alert出来的这个变量的值是对的,的确是改变后的
}); $("#file_upload_1").uploadify({
method : 'post',
//下面传参数,经测试传进去的还是宽高两个input的初始值而非用户改变后的
formData : {'type' : 1, 'classid' : <?=$classid?>, 'filepass' : <?=$filepass?> , 'doing' : 1, 'field' : 'titlepic', 'getsmall' : 1, 'width' : imgwidth, 'height' : imgheight},
height : 30,
swf : '/e/extend/talent/upload/uploadify.swf',
uploader : '/e/extend/talent/upload/up.php',
width : 120,
onUploadSuccess : function(file, data, response) {
alert(imgwidth); //走到这里alert出来的值也是改变后的,但上面传进去的说什么都是初始的
alert(data);
$("#picurl").val(data);
}
});
});
</script>
<input type="file" name="file_upload" id="file_upload_1" />
宽度 <input name="width" type="text" id="width" value="105" size="6">
高度 <input name="height" type="text" id="height" value="118" size="6">
解决方案 »
- Is there no JavaScript syntax, method that allows you to change the string?
- 这段JS在非IE浏览器下不执行,为什么?
- 请高手把这四行代码翻译成jQuery语句,学习中...
- 一个输出的问题
- 图片大小缩放问题,分不多,一定给分!
- 大师请进怎么往JQ插件中传值
- 怎样在框架的头部做链接,打开另一页面,并且框架关闭;
- 求救!!!!完成者200分!!!!不够再加!!!!我做了一个编辑页面,大家可以参考一下。
- 如何动态设置表格某行的onclick()(50分)
- out_ID = setTimeout(menuOut(LayerID), 1000000000) ,为什么速度那么快?
- 鼠标打击图片在原图上放大,在点击返回原图
- 请问用cookie做表单如何弄呢?
settings : function(name, value, resetObjects)