Home > front end >  Why JavaScript event element loses focus does not work?
Why JavaScript event element loses focus does not work?

Time:01-25

 & lt; ! Doctype html> 


<meta charset="utf-8" & gt;
JavaScript event element loses focus browsers do not display & lt;/title> <br/><style> <br/></style> <br/></head> <br/><body> <br/><Input type="text" id="username" & gt; <br/><script> <br/>//JavaScript event element loses focus browsers do not display <br/>//event focus <br/>Var name=document. GetElementById (" username "); <br/>Name. The onblur=function () {<br/>Alert (" element loses focus!" ); <br/>} <br/></script> <br/></html> </pre> <br/><p class="article - content rp"> CodePudding user response: </p>Don't do a global variable with the name, a variable name. <br/>Because global variables in js attributes of the object is the window, the window object in the name of this there is an inherent attribute, is the name of the window, the value can only be as a string, <br/><br/> </div> <div class="th_page th_page_color"></div> <div class="umCopyright"> <p>Page link:<a href="/frontend/99818.html" target="_blank" style="color:#999">https//www.codepudding.com/frontend/99818.html</a></p> </div> <div class="detail-arr"> <div class="detail-arr-left">Prev:<a href='/frontend/99817.html'>Vue3.0 element - plus imitation WeChat web chat client instance</a></div> <div class="detail-arr-right">Next:<a href='/frontend/99819.html'>The continue and labels are used together, the variables in the loop body why can also increasing th</a></div> </div> </div> </div> </div> </div> <div class="container th_top"> <div class="row"> <div class="col-md-12"> <div class="hot-tags neitags"> <ul> <li><i class="iconfont icon-x-tags"></i> Tags:  </li> <a href='/e/tags/?tagname=JavaScript' target='_blank'>JavaScript</a> </ul> </div> </div> </div> </div> <div class="container th_top"> <div class="row"> <div class="col-md-12"> <div class="xiangguan"> <ul class="msg msghead"> <li class="tbname">Related</li> </ul> <ul> </ul> </div> </div> </div> </div> <div class="container th_top"> <div class="row"> <div class="col-md-12"> <div class="flinks"> <ul> <li><i class="iconfont icon-x-tags"></i> Links:  </li> <li class="liflinks"><a target="_blank" href="/" title="CodePudding">CodePudding</a></li> </ul> </div> </div> </div> </div> <div class="footer"> <p><span style="font-size:16px;color:#666;font-weight: bold">About Us:</span>  <a href="https://www.codepudding.com/contact.html">Contact Us</a>      <a href="https://www.codepudding.com/service.html">Terms of Service</a>      <a href="https://www.codepudding.com/privacy.html"> Privacy Policy</a></p> <p class="foot_info">Copyright © 2010-2023,Powered By <a href="/" target="_blank">CodePudding</a> </p> </div> <script type="text/javascript" src="/skin/code/tianhu.js"></script> </body></html>