DEMO回退功能对性别的优化
This commit is contained in:
parent
efe233442b
commit
ab3c1f170f
16
index.html
16
index.html
@ -105,10 +105,20 @@
|
|||||||
var value = $textarea[0].value.trim();
|
var value = $textarea[0].value.trim();
|
||||||
var index = value.lastIndexOf('的');
|
var index = value.lastIndexOf('的');
|
||||||
index = Math.max(0,index);
|
index = Math.max(0,index);
|
||||||
$textarea[0].value = value.substr(0,index);
|
var search = value.substr(0,index);
|
||||||
|
$textarea[0].value = search;
|
||||||
$textarea[1].value = '';
|
$textarea[1].value = '';
|
||||||
$btns[2].disabled=false;
|
var name = search.split('的').pop();
|
||||||
$btns[3].disabled=false;
|
if(!name){
|
||||||
|
$btns[2].disabled=false;
|
||||||
|
$btns[3].disabled=false;
|
||||||
|
}else if('爸爸,老公,儿子,哥哥,弟弟'.indexOf(name)>-1){
|
||||||
|
$btns[2].disabled=true;
|
||||||
|
$btns[3].disabled=false;
|
||||||
|
}else{
|
||||||
|
$btns[2].disabled=false;
|
||||||
|
$btns[3].disabled=true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$buttons[2].onclick = function(){
|
$buttons[2].onclick = function(){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user