鼠标移动在文字上面,让其显示详细信息
一、文字太多,以省略号结尾
<p id="p_0" onmouseover="showTooltip(this);" style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">
${checkContentTitle}
</p>
二、鼠标移动在文字上面,弹出浮动的div让其显示详细信息
<script>
function showTooltip(target) {
((/^label/,'tooltip')). = 'block';
}
function hideTooltip(target) {
((/^label/,'tooltip')). = 'none';
}
</script>
<label onmouseover='showTooltip(this);' onmouseout='hideTooltip(this);' id='label0'>把鼠标移到我上面看看...</label>
<div id='tooltip0' style='display:none;border:1px solid gray;background-color:yellow;color:blue;'><p>这是一段文字的详细信息</p></div>
三、完整的JSP代码
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import=""%>
<%
String mobile_home_url = ("");
%>
<script>
function showTooltip(target) {
((/^p_/,'div_tip_')). = 'block';
("div_title"). = 'none';
}
function hideTooltip(target) {
((/^p_/,'div_tip_')). = 'none';
("div_title"). = 'block';
}
</script>
<div class="nav">
<div class="return"></div>
<!-- 标题 -->
<div id="div_title" class="headline">
<p id="p_0" onmouseover="showTooltip(this);" style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">
${checkContentTitle}
</p>
<span>${checkContentNum}</span>
</div>
<div id="div_tip_0" style="display:none;" class="headline">
<p id="p_0" onmouseout="hideTooltip(this);">
${checkContentTitle}
</p>
<span>${checkContentNum}</span>
</div>
<div class="home"></div>
</div>
<script>
var historyBack = "${historyBack}";
var searchForm = "${SearchForm}"
var returnUrl = "${returnUrl}";
$(".return").on("click",function() { // 返回
if(historyBack == "true") { // historyBack为true
(-1);
} else {
if(searchForm==null||searchForm=="") { // searchForm为空
if(returnUrl==null || returnUrl=="") { // returnUrl为空
=;
}else{ // returnUrl非空
var locationUrl = () + returnUrl;
= locationUrl;
}
} else { // searchForm非空
if(returnUrl==null || returnUrl=="") { // returnUrl为空
=;
}else{ // returnUrl非空
$("#"+searchForm).attr("action", () + returnUrl);
$("#"+searchForm).submit();
}
}
}
});
$(".home").on("click",function() { // 主页
var locationUrl = "<%=mobile_home_url%>";
= locationUrl;
});
</script>