✍ 📁 🙈 🙉 🙊
HTML
window Resize
html 測試 左入右出
html 測試 上入下出
html 測試 單入單出
html 測試 左單右單
顯示具有
script 條件真假 if else
標籤的文章。
顯示所有文章
顯示具有
script 條件真假 if else
標籤的文章。
顯示所有文章
if else while
JavaScript Math Object
是一個擁有數學常數及數學函數。
<pre><b>JavaScript if, else, and else if</b> if (condition 狀況) { block of code to be executed if the condition is true 條件為真時執行的代碼塊 } else if (condition2 狀況) { block of code to be executed if the condition1 is false and condition2 is true 條件 1 為假且條件 2 為真時執行的代碼塊 } else { block of code to be executed if the condition is false 條件為假時執行的代碼塊 } 比較運算子: 等於: == 不等於:!== 大於: > 小於:< 大於等於: >= 小於等於:<= 連接兩個以上的條件都是true && 連接兩個其中一個條件成true || </pre> <script> function Fif(x) { var Select = "??" ; if(x==10){ Select = "ten"} if(x==30){ Select = "thirty"} if(x==60){ Select = "sixty"} if(x==90){ Select = "ninety"} txt.innerHTML =Select ; } </script> <style> input {cursor:pointer;} pre { font-size: 20px ; white-space: pre-wrap; /* css-3 */ white-space: -moz-pre-wrap; /* Mozilla, since 1999 */ white-space: -pre-wrap; /* Opera 4-6 */ white-space: -o-pre-wrap; /* Opera 7 */ word-wrap: break-word; /* Internet Explorer 5.5+ */ } b{font-size:30px;color:blue;} r{font-size:20px;color:red;} </style>
預覽
寫程式
還原
LLLLLLLLLLLLLLLLL
<pre><b>script if 條件敘述</b> <<c>input onclick="Fif(this.value)" type="button" value="10" /> <<c>input onclick="Fif(this.value)" type="button" value="30" /> <<c>input onclick="Fif(this.value)" type="button" value="60" /> <<c>input onclick="Fif(this.value)" type="button" value="90" /> <<c>input onclick="Fif(this.value)" type="button" value=" " /> <<c>span id="txt">??<<c>/span> <<c>script> var Select = "??" ; if(x==10){ Select = "ten"} if(x==30){ Select = "thirty"} if(x==60){ Select = "sixty"} if(x==90){ Select = "ninety"} txt.innerHTML =Select ; } <<c>/script> <input onclick="Fif(this.value)" type="button" value="10" /> <input onclick="Fif(this.value)" type="button" value="30" /> <input onclick="Fif(this.value)" type="button" value="60" /> <input onclick="Fif(this.value)" type="button" value="90" /> <input onclick="Fif(this.value)" type="button" value=" " /> <span id="txt">??</span> </pre> <script> function Fif(x) { var Select = "??" ; if(x==10){ Select = "ten"} if(x==30){ Select = "thirty"} if(x==60){ Select = "sixty"} if(x==90){ Select = "ninety"} txt.innerHTML =Select ; } </script> <style> input {cursor:pointer;} pre { font-size: 20px ; white-space: pre-wrap; /* css-3 */ white-space: -moz-pre-wrap; /* Mozilla, since 1999 */ white-space: -pre-wrap; /* Opera 4-6 */ white-space: -o-pre-wrap; /* Opera 7 */ word-wrap: break-word; /* Internet Explorer 5.5+ */ } b{font-size:30px;color:blue;} r{font-size:20px;color:red;} </style>
預覽
寫程式
還原
LLLLLLLLLLLLLLLLL
<pre><b>script if 條件敘述</b> <<c>input onclick="Fif(this.value)" type="button" value="10" /> <<c>input onclick="Fif(this.value)" type="button" value="30" /> <<c>input onclick="Fif(this.value)" type="button" value="60" /> <<c>input onclick="Fif(this.value)" type="button" value="90" /> <<c>input onclick="Fif(this.value)" type="button" value=" " /> <<c>span id="txt">??<<c>/span> <<c>script> function Fif(x) { var Select = (x==10)?"is 10" : (x==30)?"is 30" : (x==60)?"is 60": (x>10)?"is 90": "??"; txt.innerHTML = Select ; } <<c>/script> <input onclick="Fif(this.value)" type="button" value="10" /> <input onclick="Fif(this.value)" type="button" value="30" /> <input onclick="Fif(this.value)" type="button" value="60" /> <input onclick="Fif(this.value)" type="button" value="90" /> <input onclick="Fif(this.value)" type="button" value=" " /> <span id="txt">??</span> </pre> <script> function Fif(x) { var Select = (x==10)?"is 10" : (x==30)?"is 30" : (x==60)?"is 60" : (x>10)?"is 90":"??"; txt.innerHTML =Select ; } </script> <style> input {cursor:pointer;} pre { font-size: 20px ; white-space: pre-wrap; /* css-3 */ white-space: -moz-pre-wrap; /* Mozilla, since 1999 */ white-space: -pre-wrap; /* Opera 4-6 */ white-space: -o-pre-wrap; /* Opera 7 */ word-wrap: break-word; /* Internet Explorer 5.5+ */ } b{font-size:30px;color:blue;} r{font-size:20px;color:red;} </style>
預覽
寫程式
還原
LLLLLLLLLLLLLLLLL
<pre><b>script if 條件敘述</b> 請選擇 30 Please select 30 <<c>input onclick="Fif(this.value)" type="button" value="10" /> <<c>input onclick="Fif(this.value)" type="button" value="30" /> <<c>input onclick="Fif(this.value)" type="button" value="60" /> <<c>input onclick="Fif(this.value)" type="button" value="90" /> <<c>input onclick="Fif(this.value)" type="button" value=" " /> <<c>span id="txt">??<<c>/span> <<c>script> function Fif(x) { if (x==30){txt.innerHTML= '選擇正確choose correctly';return } else if( x < 30) {txt.innerHTML='選擇小於/ hoose less than 30'} else {txt.innerHTML='選擇大於/ elect greater than 30' } } <<c>/script> 請選擇 30 Please select 30 <input onclick="Fif(this.value)" type="button" value=1 /> <input onclick="Fif(this.value)" type="button" value=20 /> <input onclick="Fif(this.value)" type="button" value=30 /> <input onclick="Fif(this.value)" type="button" value=60 /> <input onclick="Fif(this.value)" type="button" value=90 /> <span id="txt">??</span> </pre> <script> function Fif(x) { if (x==30){txt.innerHTML= '選擇正確choose correctly';return } else if( x < 30) {txt.innerHTML='選擇小於 / Choose less than 30' } else {txt.innerHTML='選擇大於 / Select greater than 30' } } </script> <style> input {cursor:pointer;} pre { font-size: 20px ; white-space: pre-wrap; /* css-3 */ white-space: -moz-pre-wrap; /* Mozilla, since 1999 */ white-space: -pre-wrap; /* Opera 4-6 */ white-space: -o-pre-wrap; /* Opera 7 */ word-wrap: break-word; /* Internet Explorer 5.5+ */ } b{font-size:30px;color:blue;} r{font-size:20px;color:red;} </style>
預覽
寫程式
還原
LLLLLLLLLLLLLLLLL
Edit
#html
#網頁格式
#script
#style
#div
#script 條件真假 if else
#script if else
#運算子
較舊的文章
首頁
訂閱:
文章 (Atom)