吳敏瑄python期中考javascript按鈕button事件onchange

截圖

吳敏瑄輸入參數

輸入k
輸入m
輸入n

重點

alert內建函數,自訂函數abc span手掌張開拇指到小指,短橋梁長度。 VSCode是IDE整合開發環境。 Integrated Development Environment CTRL+SHIFT+L一次改全部。 利用id加上style方法是#id。

吳敏瑄輸出結果

CSS示範程式

h1{background-color: darkblue; color: white; border: 10px solid gray; text-align:center; padding: 5px} ul{background-color: lightblue; color: white; font-size: 2em;line-height:1.5} input{font-size:24px;background-color:rgb(210, 250, 215);} .monkey{font-size:36px;} pre{color: white;background-color: lightblue;}

HTML示範程式碼

<h1>吳敏瑄輸入參數</h1>
<span class="spanstyle">輸入k<input id="k" type="number" value="1" /><br />
<span class="spanstyle">輸入m<input id="m" type="number" value="1" /><br />
<span class="spanstyle">輸入n<input id="n" type="number" value="1" /><br />
<button onclick="abc()">執行自訂函數</button>
<select id='mySelect' onchange="change()">
<option>red</option>
<option>blue</option>
<option>green</option>
</select>
<h1>重點</h1>
alert內建函數,自訂函數abc
span手掌張開拇指到小指,短橋梁長度。
VSCode是IDE整合開發環境。
Integrated Development Environment
CTRL+SHIFT+L一次改全部。
利用id加上style方法是#id。
<h1>吳敏瑄輸出結果</h1>
<div class="monkey" id="out"></div>

JAVASCRIPT示範程式碼

const space=' ', slash='/', backslash='\\', cr='\n';
function row1(k,m){
    for(let i=0; i<k;i++){
        for(let ii=0; ii<m; ii++){
            for(let j=0; j<k-i-1; j++)
                out+=space;
            out+=slash;
            for(let j=0; j<2*i; j++)
                out+=space;
            out+=backslash;
            for(let j=0; j<k-i-1;j++)
                out+=space;};
    out+=cr;};};
function row2(k,m){
    for(let i=0; i<k; i++){
        for(let ii=0; ii<m; ii++){
            for(let j=0; j<i; j++)
                out+=space;
            out+=backslash;
            for(let j=0; j<2*k-2*i-2; j++)
                out+=space;
        out+=slash;
        for(let j=0; j<i;j++)
            out+=space;};
    out+=cr;};};
function abc(){
    k = document.getElementById('k').value;
    m = document.getElementById('m').value;
    n = document.getElementById('n').value;
    out ='<pre>吳敏瑄\n';
    for(let i=0; i<n; i++){
        row1(k,m);
        row2(k,m);}
    out += '</pre>';      
    document.getElementById('out').innerHTML=out;}

留言

這個網誌中的熱門文章

吳敏瑄VS Code俄羅斯方塊maintain維護物件object

吳敏瑄金融市場常識測驗 JavaScript測驗

吳敏瑄bro code snake game python