JavaScript cannot obtain the attribute without writing the tag. Remember, only if you write the attribute to the tag, for example, if you want to get the id of a div, but if you don't explicitly add it, you don't have this attribute.
I wondered before, why visibility can implement the hiding and display of divs while display is not possible. I clearly remember that it was possible before, but it turned out that I wrote visibility for it in the style attribute, but not display, but before it was displayed.
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%><html> <head> <title>Basic information of vehicles</title> <script language="javascript" type="text/javascript" src="../js/autocomplete/jquery-1.7.2.min.js"></script> <script type="text/javascript"> function isdisplay3(){ var boo1 = $("#doing1").attr("style"); var boo2 = $("#doing2").attr("style"); if("" != boo1){ if(document.getElementById('doing1').style.display){ //No alert("getElementById('doing1').style.display){ alert("getElementById('doing1').style.visibility){ alert("getElementById('doing1').style.visibility){ alert("getElementById('doing1').style.visibility){ alert("getElementById('doing2').style.display){ alert("getElementById('doing2').style.display){ alert("getElementById('doing2').style.display){ alert("getElementById('doing2').style.visibility){ alert("getElementById('doing2'). if(document.getElementById('doing2').style.visibility){ //Not written, alert("getd visibility of doing2"); } } } </script> </head> <body> <input type="button" value="layer" onclick="isdisplay3()" /> <div id="doing1" style="visibility: hidden"> </div> <div id="doing2" style="display: none"> </div> </body></html>The above is the full content of the solution to the JS attributes that cannot be obtained from the html tags brought to you by me. I hope everyone can support Wulin.com more~