Change input style CSS via onfocus method - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Form Event

Description

Change input style CSS via onfocus method

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <script type="text/javascript">
function changeTrStyle()//from  ww w  . ja v a  2  s  .c o  m
{
document.getElementById("trId").style.background = "red";
}

      </script> 
   </head> 
   <body> 
      <table> 
         <tbody>
            <tr id="trId"> 
               <td> 
                  <input type="text" onfocus="changeTrStyle()"> 
               </td> 
            </tr> 
         </tbody>
      </table>  
   </body>
</html>

Related Tutorials