0
<!DOCTYPE html>
<html>
<body>

<p>How would you like your coffee?</p>

<form>
  <input type="radio" name="coffee" value="= 0">1s<sup>1</sup><br>
  <input type="radio" name="coffee" value="= 0,3">1s<sup>2</sup><br>
  <br>
  <input type="button" onclick="myFunction1()" value="Xem Kết quả">
  <br><br>
  <input type="text" id="order" size="50">

</form>

<script>
function myFunction1() {
    var coffee = document.forms[0];
    var txt = "";
    var i;
    for (i = 0; i < coffee.length; i++) {
        if (coffee[i].checked) {
            z_array= new Array();
            z_array[1]=0;
            z_array[2]=0.3;
            txt = txt + coffee[i].value + " ";
        }
    }
    document.getElementById("order").value = "Hằng số chắn của AO-1s: "+"σ(1s)" + txt
}

</script>
<br/>
Điền vào số Z:

<form>
<input id="solieu" type="text" name="n" size="30" maxlength="3" value=""> <br>
 <input type="reset" value="Reset" onclick="n.focus()">
</form>

Nhấn để xemkeets quả:

<button onclick="myFunction2()">Try it</button>
<p id="demo"></p>

<script>
function myFunction2() {
    var x = document.getElementById("solieu").value;
        z=x;

    var  cau_hinh = "[Rn]"+" "+ z+"2".sup();
     // In ra màn hình
       document.getElementById("demo").innerHTML = cau_hinh;
 
}
</script>
</body>
</html>
=============================
Hàm sau cũng cho 1 gợi ý rất thú vị:

<!DOCTYPE html>
<html>
<body>

<form>
Select numbers:<br>
<select id="no">
<option>0</option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
<option>6</option>
<option>7</option>
<option>8</option>
<option>9</option>
</select>
<input type="button" onclick="myFunction()" value="-->">
<input type="text" id="result" size="20">
</form>

<script>
function myFunction() {
    var a = document.getElementById("no");
    var option = a.options[no.selectedIndex].text;
    var txt = document.getElementById("result").value;
    txt = txt + option;
    document.getElementById("result").value = txt;
}
</script>

</body>
</html>

Đăng nhận xét

 
Top