2013年12月2日 星期一

LAB 27

A=0.15+0.85(C/2)
B=0.15+0.85A
C=0.15+0.85(A+B)

A = 0.425C+0.15---(1) B = 0.85A++0.15---(2) C = 0.85A+0.85B+0.15---(3) (1).(2).(3) 聯立解

B=0.15+0.85(0.15+0.025C) =0.15+0.1275+0.36125C C=0.15+0.85(0.15+0.425)+0.85(0.15+0.1275+0.35125C) =0.15+0.1275+0.36125C+0.1275+0.108375+0.3070625C =0.513375+0.6683125C => 0.3316875C=0.513375 => C=1.5477671 B=0.15+0.1275+0.36125*1.5477671=0.83663086 A=0.15+0.45*1.5477671=0.807801012 C>B>A

2013年11月11日 星期一

Lab 26


LAB 25





Lab 24



Lab 23









HW 1105

<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <meta http-equiv="Content-Script-Type" content="text/javascript">
    <script type="text/javascript">
      var re = /\(?\d{4}\)?([-\/\.])\d{3}\1\d{3}/;
      function check(){
    var OK = re.exec(f.q.value);
        if (!OK)
          {window.alert(RegExp.input + " isn't a phone number with area code!");
         f.q.value="";
        document.f.q.focus();
        return false; }  
         else
       window.alert("Thanks, your phone number is " + OK[0]);
     
 }
    </script>
  </head>
  <body>
    <p>Enter your phone number .
        <br>The expected format is like ####-###-###.</p>
    <form name="f" action="#" onsubmit="return check()" method="get">
       check:<input type="text" name="q">    
     <input id="phone" type="submit" value="check">
    </form>
  </body>
</html>










2013年10月28日 星期一

HW1021

<html>
<html>
<head>
</head>
<body id="body">
<form action="javascript:void(0);" id="exampleForm">
<input type="text" id="examplePass"/>
<input type="submit" />
</form>
</body>
<script>
document.getElementById("exampleForm").onsubmit = function(){
var passwordRegex =/^(-?[\d])*$/;
if(!passwordRegex.test(document.getElementById("examplePass").value)){
console.log("Regex didn't match");
var notify = document.getElementById("notify");
if(notify === null){
notify = document.createElement("p");
notify.textContent = "ERROR";
notify.id ="notify";
var body =document.getElementById("body");
body.appendChild(notify);
}
}
};
</script>
</html