增加功能:滑块式验证码增加本地图片,如果远程随机图出现问题后加载本地图片
This commit is contained in:
parent
af01434cc7
commit
7d7af71559
Binary file not shown.
After Width: | Height: | Size: 8.2 KiB |
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
Binary file not shown.
After Width: | Height: | Size: 6.4 KiB |
Binary file not shown.
After Width: | Height: | Size: 4.6 KiB |
Binary file not shown.
After Width: | Height: | Size: 8.4 KiB |
|
@ -126,6 +126,9 @@
|
||||||
var getRandomNumberByRange = function (start, end) {
|
var getRandomNumberByRange = function (start, end) {
|
||||||
return Math.round(Math.random() * (end - start) + start);
|
return Math.round(Math.random() * (end - start) + start);
|
||||||
};
|
};
|
||||||
|
var localImg = function () {
|
||||||
|
return $.format('../images/Pic{0}.jpg', Math.round(Math.random() * 4));
|
||||||
|
};
|
||||||
var img = new Image();
|
var img = new Image();
|
||||||
img.crossOrigin = "Anonymous";
|
img.crossOrigin = "Anonymous";
|
||||||
img.onload = function () {
|
img.onload = function () {
|
||||||
|
@ -144,7 +147,7 @@
|
||||||
that.text.text(that.text.attr('data-text'));
|
that.text.text(that.text.attr('data-text'));
|
||||||
};
|
};
|
||||||
img.onerror = function () {
|
img.onerror = function () {
|
||||||
img.setSrc();
|
img.src = localImg();
|
||||||
}
|
}
|
||||||
img.setSrc = function () {
|
img.setSrc = function () {
|
||||||
var src = '';
|
var src = '';
|
||||||
|
|
Loading…
Reference in New Issue