javascript中獲得焦點onfocus與失去焦點onblur

 

 

 

 

 

javascript中獲得焦點onfocus與失去焦點onblur

2010年10月12日星期二 下午01:43

 

<html>
<head>
<script language="javascript">
window. function(){
var oName = document.getElementById('sd');

     oName.onfocus = function(){
       oName.value='';
     };

     oName.onblur = function(oEvent){
     var oTarget;
     if(window.event) oEvent = window.event;
      if(oEvent.srcElement)
             oTarget=oEvent.srcElement;
      else 
        oTarget = oEvent.target;
oTarget.value='lll';

};

};
</script>

You May Also Like