File tree Expand file tree Collapse file tree 1 file changed +6
-13
lines changed Expand file tree Collapse file tree 1 file changed +6
-13
lines changed Original file line number Diff line number Diff line change @@ -102,38 +102,31 @@ function allDisable(except){
102
102
}
103
103
104
104
function isCountInputValid ( countNum ) {
105
- console . log ( countNum ) ;
106
- if ( countNum < 5 || countNum > 500 ) {
105
+ if ( ! countNum || countNum < 5 || countNum > 500 ) {
107
106
return null ;
108
107
}
109
108
return countNum ;
110
109
}
111
110
112
111
function isMspfInputValid ( mspfInput ) {
113
- console . log ( typeof mspfInput ) ;
114
- if ( mspfInput < 5 || mspfInput > 1000 ) {
112
+ if ( ! mspfInput || mspfInput < 5 || mspfInput > 1000 ) {
115
113
return null ;
116
114
}
117
115
return mspfInput ;
118
116
}
119
117
120
- function errDisaply ( entryNum , mspfNum ) {
121
- const errInput = document . getElementById ( 'err' ) ;
122
- if ( entryNum === null || mspfNum === null ) {
123
- errInput . textContent = 'Input Invalid' ;
118
+ function inputInvalid ( entryNum , mspfNum ) {
119
+ if ( ! entryNum || ! mspfNum ) {
124
120
return true ;
125
121
}
126
- // if(){
127
- // mspfInput.border = "red solid 1px";
128
- // return true;
129
- // }
130
122
return false ;
131
123
}
132
124
133
125
function prepareForRun ( ) {
134
126
one . entryNum = isCountInputValid ( parseInt ( countInput . value , 10 ) ) ;
135
127
one . milliSecPerFrame = isMspfInputValid ( parseInt ( mspfInput . value , 10 ) ) ;
136
- if ( errDisaply ( one . entryNum , one . milliSecPerFrame ) ) {
128
+ if ( inputInvalid ( one . entryNum , one . milliSecPerFrame ) ) {
129
+ window . alert ( '圖形數量、ms per frame 輸入錯誤,\n請重新輸入' )
137
130
return
138
131
}
139
132
one . generateElements ( ) ;
You can’t perform that action at this time.
0 commit comments