2016年4月29日 星期五

網頁選項









<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=BIG5">
<title>第一支javaScript</title>
</head>
<body>
<h2>document.write用法</h2>
 <Script type ="text/javascript">
</Script>

 <form action="#" method="post" class="demoForm" id="demoForm">
    <fieldset>
        <legend>Demo: Get Value of Selected</legend>
   
    <p>Select a shipping method:</p>
    <p>
        <label><input type="radio" name="ship" value="A" checked /> (A)Standard Ground</label>
        <label><input type="radio" name="ship" value="B" /> (B)Second Day</label>
        <label><input type="radio" name="ship" value="C" /> (C)Overnight</label>
        <label><input type="radio" name="ship" value="D" /> (D)Pick up</label>
    </p>
   
    <p><button type="button" name="getVal">Get Value of Selected</button></p>
   
    </fieldset>
</form>
<script type="text/javascript">
// to remove from global namespace
(function() {
   
    function getRadioVal(form, name) {
        var val;
        var radios = form.elements[name];
       
        for (var i=0, len=radios.length; i<len; i++) {
            if ( radios[i].checked ) {
                val = radios[i].value;
                break;
            }
        }
        return val;
    }


    document.forms['demoForm'].elements['getVal'].onclick = function() {
        alert( 'The selected radio button\'s value is: ' + getRadioVal(this.form, 'ship') );
    };
   
   
    // disable submission of all forms on this page
    for (var i=0, len=document.forms.length; i<len; i++) {
        document.forms[i].onsubmit = function() { return false; };
    }
   
}());
</script>

</body>
</html>

2016年4月21日 星期四

第一個APP


第四次上課

建立login.php
<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "test";

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT * FROM `user`";
$result = $conn->query($sql);

if ($result != null) {
    // output data of each row
    while($row = $result->fetch_assoc()) {
        echo "id: " . $row["name"]. $row["passwd"]. "<br>";
    }
} else {
    echo "0 results";
}
$conn->close();
?>

第3次上課

1.下載阿帕契
2.在網頁打localhost/phpmyadmin/
3.建立新的資料庫  編碼utf_8_unicode_ci
4.建立資料表欄位5
5.   name               varchar              15
      gender             char                   1
      mobile            varchar              15
      phone             varchar               15
      address           varchar              30
6.新增一筆資料
7.輸入資料
8.

第二次上課

1.下載阿帕契
2.到C:\xampp\htdocs\dashboard這裡,新增demo.php
3.複製貼上
<?php
// 這是 C++ 風格註解
#  這是 Perl 風格註解
 
echo "\n\n";
echo date("Y/m/d")."\n";
echo "↑↑ 上面印出今天幾月幾日\n";
echo strftime("%X", time())."\n";
echo "↑↑ 上面印出現在幾點幾分\n";
echo "\n\n";
 
/* 《程式語言教學誌》的範例程式
    檔名:demo.php
    功能:示範 PHP 程式
    作者:張凱慶
    時間:西元 2012 年 11 月 */
?>
http://pydoing.blogspot.tw/2012/11/php-Understanding-of-PHP-Progamming-Language.html
4.把附檔名改為.php
5.找到php.ini檔將UTF-8改為Big5
6.然後到網頁打
http://localhost/dashboard/demo.php