
[parsehtml]
<div id="dm">
<label for="name">Nhập Tên Của Bạn:</label>
<input type="text" id="name" style="font-size: 15px;padding: 3px;">
<br>
<br>
<label for="sex">Giới Tính:</label>
<select id="sex" style="padding: 5px;">
<option value="m">Nam</option>
<option value="f">Nữ</option>
</select>
</div>
<div id="area"></div>
<br>
<span id="xem" style="background: #5985ff; color: white;padding: 4px;padding-bottom: 5px;cursor: pointer;" onclick="processThuPhap();">Xem Kết Quả</span>
<span id="ref" style="background: #5985ff; color: white;padding: 7px;cursor: pointer;display: none;" onclick="shareThuPhap();">Share Lên FaceBook</span>
<span id="tenkhac" style="background: #5985ff; color: white;padding: 7px;cursor: pointer;display: none;" onclick="tenThuPhapKhac();">Tên Khác</span>
<script>
function processThuPhap(){
if($('#name').val()==""||$('#name').val().length<5||$('#name').val().length>60)
alert('Tên Không Hợp Lệ');
else{
$("#area").html("<img class ='img' src='https://ift.tt/s2oyalE" + $('#name').val().replace(/ /gi, "-")+'-'+$('#sex').val() + ".png' />");
$('#dm').hide();
$('#xem').hide();
$('#ref').show();
$('#tenkhac').show();
}
}
function tenThuPhapKhac(){
$('#dm').show();
$('#xem').show();
$('#ref').hide();
$('#tenkhac').hide();
$("#area").html("");
}
function shareThuPhap(){
window.open('https://ift.tt/k1jhbL9 /gi, "-")+'-'+$('#sex').val()+'.html','_blank');
}
</script>
[/parsehtml]
Nguồn: Techrum
0 nhận xét: