取最後一個數字
加上中間第2-4個數字
最後加上第一個數字,然後alert
比如用戶輸入
12345
要彈出顯示的是52341
<html>
<input type="text" id="t1" onkeyup=" " > </input>
<input type="button" value="提交" id="btn" disabled='disabled' onclick=" "> </input>
</html>
<script>
$(document).ready(function(){
$('#t1').on('keyup', function(){
this.value = this.value.replace(/\D/g, '');
var v = $('#t1').val();
if(!v){
$('#btn').attr('disabled', true);
}
else {
$('#btn').attr('disabled', false);
}
});
$('#btn').on('click', function(){
var v = $('#t1').val();
m = v.substr(4, 1);
m2 = v.substr(1, 3);
m3 = v.substr(0, 1)
alert(m +m2 + m3);
});
});
</script>