i got the following
<span id="pageLink" style="cursor:pointer;" onClick="...." title="<%=pHelper.getNameToolTip()%>">
in firefox the tooltip stays the开发者_JS百科re until the mouse is moved, but in IE it only stays there for about 5seconds and disappears.
is there a way to make it last longer?
Not with built-in browser tooltips, no.
There are tons of tooltip-like UI components using positioned DOM elements that will give you much finer control of presentation and display duration. I've never used one so couldn't vouch for any of them, so I won't link to any. Googling "JavaScript tooltip" will get you plenty. There are also plenty of tooltip plug-ins for existing libraries like jQuery around.
Not sure if you're inclined to using jQuery, but there are many tooltip plugins that will provide the functionality you're looking for, along with some extras.
You might be able to change the answer on jquery dynamic tooltip to your needs
As mentioned by others, you can't change the default way that browsers display tooltips. You are also very limited in your display capabilities. (e.g. Text only, no control of layout, wrapping, or styling, no images, ...) I used jQuery Tooltip on project and it worked out extremely well. It provides you a high degree of control over your tooltips, including display of arbitrary content. Highly recommended.
http://bassistance.de/jquery-plugins/jquery-plugin-tooltip/
A simple tooltip can be created with just CSS if you do not mind adding a little HTML.
.tipLink{
color:#ff3333;
cursor:pointer;
position:relative;
}
.tip{
position:absolute;
display:none;
top:10px;
left:30px;
background-color:#dddddd;
border:1px solid black;
width:100px;
color:black;
-webkit-border-radius:5px 5px 5px 5px;
-moz-border-radius:5px 5px 5px 5px;
border-radius:5px 5px 5px 5px;
text-align:center;
}
.tipLink:hover .tip{
display:block;
}
and the HTML will look like
<div>Select as many as apply
<span class='tipLink'>?
<span class='tip'>Press Ctrl to choose more than one option.</span>
</span>
</div>
<br/>
精彩评论