A buddy wants to add the border effect when the mouse passes through the image. Unfortunately, the starting point is wrong. It is directly added to the tag outside the IMG, causing the image to collapse when the mouse passes through, in fact, you should add the border control directly to the IMG label.
The error code is as follows: Pay attention to the red part settings (the starting point is wrong)
Copy codeThe Code is as follows:
<Html>
<Head>
<Script type = "text/javascript" src = "http://www.w3school.com.cn/jquery/jquery.js"> </script>
<Script type = "text/javascript">
$ (Document). ready (function (){
$ ("# Box a"). mouseover (function (){
Certificate (this).css ("border", "1px solid red ");
});
$ ("# Box a"). mouseout (function (){
Certificate (this).css ("border", "none ");
});
});
</Script>
<Style>
# Box a {display: block; z-index: 1000; width: 98px; height: 98px ;}
</Style>
</Head>
<Body>
<Div id = "box" style = "width: 100px; height: 100px;">
<A href = "#"> </a>
<A href = "#"> </a>
</Div>
</Body>
</Html>
Correct design concept after modification: The red part is the adjusted settings
Copy codeThe Code is as follows:
<Html>
<Head>
<Script type = "text/javascript" src = "http://www.w3school.com.cn/jquery/jquery.js"> </script>
<Script type = "text/javascript">
$ (Document). ready (function (){
$ ("# Box img"). mouseover (function (){
Certificate (this).css ("border", "1px solid red ");
});
$ ("# Box img"). mouseout (function (){
Certificate (this).css ("border", "none ");
});
});
</Script>
<Style>
# Box a {display: block; z-index: 1000; width: 98px; height: 98px ;}
</Style>
</Head>
<Body>
<Div id = "box" style = "width: 100px; height: 100px;">
<A href = "#"> </a>
<A href = "#"> </a>
</Div>
</Body>
</Html>