html怎么实现鼠标放在文字上显示文字(附带代码)?

html-css012

html怎么实现鼠标放在文字上显示文字(附带代码)?,第1张

实现鼠标悬停显示文字,html中使用title属性就可实现显示文字的效果,这个属性还是比较实用的,你可以参考下

<a href="#" title="这里是显示的文字">hello</a>

当鼠标悬停在 hello上一会就会有文字 "这里是显示的文字" 显示。

给按钮上绑定一个onclick事件,同时置一个状态值,状态值为true时显示按钮。

具体代码如下:

<html>

<head>

<script type="text/javascript" src="https://ss1.bdstatic.com/5eN1bjq8AAUYm2zgoY3K/r/www/cache/static/protocol/https/jquery/jquery-1.10.2.min_f2fb5194.js"></script>

</head>

<body>

<button id="a">btn1</button>

<button id="b">btn2</button>

<script>

$(document).ready(function()

{

$("#a").click(function()

{

$("#a").hide()

})

$("#b").click(function()

{

$("#a").show()

}

)

})

</script>

</body>

</html>