text控件监听键盘弹出和关闭示例代码

  • Post author:
  • Post category:其他


<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
</head>
<body>
   <nav title="首页">
   <input type="text" value="我是text控件,我的作用是输入" id="myText"/>   
 </body>
<script>

if($M.isAndroid)
{
   myText.addEvent("onKeybordClosed",function(){
    log("键盘关闭了");
});


myText.addEvent("onKeybordOpened",function(){
    log("键盘打开了");
});
   
}

if($M.isIOS)
{

   myText.addEvent("onFocus",function(){
   log("键盘打开了");
   });
 
   myText.addEvent("onBlur",function(){
    log("键盘关闭了");
   }); 
   
   
}

</script>
</html>



版权声明:本文为haozhenming原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。