close

http://pclevin.blogspot.tw/2011/12/javascriptjavascript.html
貼在wordpad上 另存新檔 test.html

<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">
  document.write("Hello world!!");
 </Script>
</body>
</html>

未命名 (1).png
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=BIG5">
<title>第一支javaScript</title>
</head>
<body>
<input type="checkbox" name="interest" value="單 打 獨 鬥" id="1"><label for="1">單 打 獨 鬥---------------</label><label for="demoradio_1">

<div class="qheader">
1) What is the difference between a jungle and a rain forest?</div>
<div class="qselections">
<input type="radio" value="a" name="question1">a) No difference. Simply two different ways in referring to the same thing.<br>
<input type="radio" value="b" name="question1">b) A jungle in general receives less rain than a rain forest.<br>
<input type="radio" value="c" name="question1">c) A jungle refers to the thickest area of a rain forest<br>
<input type="radio" value="d" name="question1">d) A jungle and a rain forest each contain their own group of distinct plants and animals.<br>
</div>

<br>

<h2>document.write用法</h2>
 <Script type ="text/javascript">
  document.write("Hello world!!");
 </Script>
</body>
</html>

 

 

1.png

<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">
  document.write("Hello world!!");
 function myFunInput(obj){
   obj
   alert("你的id編號為:"+obj.id);
  }
 </Script>
<input type="button" value="請點擊" id="myId" onClick="myFunInput(this)">
</body>
</html>

 

2.png

<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>

3.png

 

 

arrow
arrow
    全站熱搜

    a29yly1111 發表在 痞客邦 留言(0) 人氣()