2014年3月23日 星期日

javascript onblur事件練習

javascript onblur事件練習

============ 下面是 說明的部份 ============================

當焦點離開text1後,會去呼叫javascript 的 upperCase()  function

============ 下面是 HTML 的部份 ============================

<html>
<head>
    <title></title>
<script type="text/javascript">
    function upperCase() {
        var x = document.getElementById("Text1").value
        document.getElementById("Text2").value = x.toUpperCase()
    }
</script>
</head>

<body>

key in:<input type="text" id="Text1" onblur="upperCase()" />
<br/>
out :<input type="text" id="Text2"  />
</body>
</html>

沒有留言:

張貼留言