-
Notifications
You must be signed in to change notification settings - Fork 273
/
sandphoto.js
35 lines (30 loc) · 885 Bytes
/
sandphoto.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
$(document).ready(function(){
$("#target_type").change(updatePreview);
$("#container_type").change(updatePreview);
$("#sandphotoform input:radio").click(updatePreview);
$("#sandphotoform").submit(checkForm);
updatePreview();
});
function updatePreview()
{
$target_type = $("#target_type option:selected").val();
$container_type = $("#container_type option:selected").val();
$bgcolorid= $("#sandphotoform input:radio:checked").val();
if ($target_type && $container_type && $bgcolorid) {
$("#previewImg").attr("src", "/sandphoto/preview.php?t=" + $target_type + "&c=" + $container_type + "&b=" + $bgcolorid);
}
}
function checkForm()
{
if ($("#filename").val() == "")
{
alert("请选择照片后再试");
return false;
}
if (!$("#filename").val().match(/jpg|jpeg|png|tiff/i))
{
alert("只支持jpeg, jpg, png, tiff文件");
return false;
}
return true;
}