用了修改提示样式的JS,结果用\n换行不生效了 需要怎么改一下JS? var oldTitle = null; $('td').bind('mouseover mouseout mousemove', function(event) { var left = event.pageX; var top = event.pageY; var ele = event.target; var title = ele.title; var type = event.originalEvent.type; if (type == 'mouseover') { oldTitle = title; ele.title = ''; console.log(title); if (title.length != 0) { var showEle = $('', { text: title, class: 'showTitleBox' }).css({ position: 'absolute', top: top + 10, left: left, border: '1px solid #00cccc', // 边框 borderRadius: '5px', // 边框圆角 background: "#ff0000", // 背景色 fontFamily: 'SimHei', // 字体 fontSize: '20px' , // 字体大小 color: '#ffffff' }) showEle.appendTo('body'); } } else if (type == 'mouseout') { ele.title = oldTitle; $('.showTitleBox').remove(); } else if (type == 'mousemove') { $('.showTitleBox').css({ top: top + 10, left: left }) } }) |