怎么延长title的预览时间?

-一个大坑 2018-08-27 11:50:38
内容多,看不完就消失了,用户反映很大
...全文
133 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
75闪光雷 2018-08-27
  • 打赏
  • 举报
回复

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript">
function split_str(string,words_per_line) {
var output_string = string.substring(0,1);	//取出i=0时的字,避免for循环里换行时多次判断i是否为0
for(var i=1;i<string.length;i++) {
if(i%words_per_line == 0) {
output_string += "<br/>";
}
output_string += string.substring(i,i+1);
}
return output_string;
}
var title_value = '';
function title_show(td) {
var div=document.getElementById("title_show");
title_value = td.title;
div.style.left = (td.offsetLeft+230)+"px";	//设置title_show在页面中的位置。
var words_per_line = 25;	//每行字数
var title = split_str(td.title,words_per_line);	//按每行25个字显示标题内容。
div.innerHTML = title;
div.style.display = '';
td.title = '';	//去掉原有title显示。
}
function title_back(td) {
var div=document.getElementById("title_show");
td.title = title_value;
div.style.display = "none";
}
</script>
</head>
<body>
<table><tr><td onclick="update(this);" title="这里是很长很长很长很长很长
很长很长很长很长很长很长很长很长很长
很长很长很长很长很长很长很长很长很长
很长很长很长很长很长很长很长很长很长
很长很长很长很长很长很长很长很长很长的标题"
onmouseover="title_show(this);" onmouseout="title_back(this);">鼠标在这悬停显示标题</td></tr></table>
<div id='title_show'
style='position:absolute;
display:none;
border:solid 1px #999999;
background:#edeef0;
'>
</div>
</body>
</html>
-一个大坑 2018-08-27
  • 打赏
  • 举报
回复
网上搜的都是很长的代码,有没有简单的加长时间的方法
75闪光雷 2018-08-27
  • 打赏
  • 举报
回复
引用 3 楼 happy4944 的回复:
这就相当于重写td的移入移出事件,样式会变
样式这东西,你可以自己随意调整吧。
-一个大坑 2018-08-27
  • 打赏
  • 举报
回复
引用 1 楼 qq_34309305 的回复:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript">
function split_str(string,words_per_line) {
var output_string = string.substring(0,1); //取出i=0时的字,避免for循环里换行时多次判断i是否为0
for(var i=1;i<string.length;i++) {
if(i%words_per_line == 0) {
output_string += "<br/>";
}
output_string += string.substring(i,i+1);
}
return output_string;
}
var title_value = '';
function title_show(td) {
var div=document.getElementById("title_show");
title_value = td.title;
div.style.left = (td.offsetLeft+230)+"px"; //设置title_show在页面中的位置。
var words_per_line = 25; //每行字数
var title = split_str(td.title,words_per_line); //按每行25个字显示标题内容。
div.innerHTML = title;
div.style.display = '';
td.title = ''; //去掉原有title显示。
}
function title_back(td) {
var div=document.getElementById("title_show");
td.title = title_value;
div.style.display = "none";
}
</script>
</head>
<body>
<table><tr><td onclick="update(this);" title="这里是很长很长很长很长很长
很长很长很长很长很长很长很长很长很长
很长很长很长很长很长很长很长很长很长
很长很长很长很长很长很长很长很长很长
很长很长很长很长很长很长很长很长很长的标题"
onmouseover="title_show(this);" onmouseout="title_back(this);">鼠标在这悬停显示标题</td></tr></table>
<div id='title_show'
style='position:absolute;
display:none;
border:solid 1px #999999;
background:#edeef0;
'>
</div>
</body>
</html>

这就相当于重写td的移入移出事件,样式会变

87,838

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧