【发布时间】:2015-04-30 09:40:00
【问题描述】:
我有一个文件输入,在其上调用了两个函数f() 和colorit()。如果在f() 中不满足指定条件,我想停止函数colorit()。但是,一旦选择了文件,两个函数就会启动。
<body>
<div class="dClass">
<input type="file" class="iClass" />
</div>
<script>
function f(){
if () {
// if image selected does not meet requirements
// how to stop colorit(); function here ??
return false;
}
else {
alert("done");
}
}
$('.iClass').change(function() {
f(); // calling function f
});
$(function() {
$('.dClass').colorit();
//note: colorit() function also comes to action as soon as a file is selected through .iClass
});
</script>
</body>
【问题讨论】:
-
color 是一个改变div背景的功能,我想要的是如果图片不符合条件不实现为背景
-
...你的 colorit 函数运行
onload...是循环还是什么? 0_o
标签: javascript jquery html css function