tooptip.js:
复制代码代码如下:
function getViewportheight(){
if(window.innerheight!= window. undefined)return window.innerheight;
if(document.compatmode == 'css1compat')document.documentlement.clientheightを返します;
if(document.body)document.body.clientheightを返します。
window.inefinedを返します。
}
関数getViewPortWidth(){
if(window.innerwidth!= window. undefined)return window.innerwidth;
if(document.compatmode == 'css1compat')document.documentlement.clientwidthを返します;
if(document.body)document.body.clientWidthを返します。
window.inefinedを返します。
}
/**
*本物のスクロールトップを取得します
*/
function getscrolltop(){
if(self.pageyoffset)//エクスプローラーを除くすべて
{
self.pageyoffsetを返します。
}
else if(document.documentelement && document.documentelement.scrolltop)
// Explorer 6 Strict
{
document.documentlement.scrolltopを返します。
}
else if(document.body)//他のすべての探検家
{
document.body.scrolltopを返します。
}
}
function getscrollleft(){
if(self.pagexoffset)// Explorerを除くすべて
{
self.pagexoffsetを返します。
}
else if(document.documentelement && document.documentelement.scrollleft)
// Explorer 6 Strict
{
document.documentlement.scrollleftを返します。
}
else if(document.body)//他のすべての探検家
{
document.body.scrollleftを返します。
}
}
/*
[HTML]
渐变的弹出图片
使用方法:
将Tooltip.js body的结束标签后
调用方法:
[コード]
<a href = "pages.jpg"ターゲット= '_ blank' onmouseover = "tooltip( '<img src = http:// zhouzh:90/t_yestem_channel/pages_small.jpg>')" onmouseout = "Tooltip width = 30 height = 20 align = "absmiddle"> </a>
必须CSS样式
复制代码代码如下:
.trans_msg
{
フィルター:Alpha(Opacity = 100、enabled = 1)revealtrans(duration = .2、transition = 1)blendtrans(duration = .2);
}
*/
//-初始化变量 -
var rt = true; //允许图像过渡
var bt = true; //允许图像淡入淡出
var tw = 150; //提示框宽度
var endaction = false; //结束动画
var ns4 = document.layers;
var ns6 = document.getElementById &&!document.all;
var ie4 = document.all;
offsetx = 10;
Offsety = 20;
var tooltipstyle = "";
function inittooltips()
{
tempdiv = document.createelement( "div");
tempdiv.id = "tooltiplayer";
tempdiv.style.position = "absolute";
tempdiv.style.display = "none";
document.body.AppendChild(TempDiv);
if(ns4 || ns6 || ie4)
{
if(ns4)tooltipstyle = document.tooltiplayer;
else if(ns6)tooltipstyle = document.getElementById( "ToolTiplayer")。style;
else if(ie4)tooltipstyle = document.all.tooltiplayer.style;
if(ns4)document.captureevents(event.mousemove);
それ以外
{
tooltipstyle.visibility = "visible";
tooltipstyle.display = "none";
}
document.onmousemove = movetomouseloc;
}
}
関数ツールチップ(MSG、FG、BG)
{
試す {
if(tooltip.arguments.length <1)//非表示
{
if(ns4)
{
tooltipstyle.visibility = "hidden";
}
それ以外
{
//-图象过渡、淡出处理 -
if(!endaction){tooltipstyle.display = "none";}
if(rt)document.all( "msg1")。filters [1] .apply();
if(bt)document.all( "msg1")。filters [2] .apply();
document.all( "MSG1")。フィルター[0] .Opacity = 0;
if(rt)document.all( "msg1")。filters [1] .play();
if(bt)document.all( "msg1")。filters [2] .play();
if(rt){
if(document.all( "msg1")。フィルター[1] .status == 1 || document.all( "msg1")。フィルター[1] .status == 0){
tooltipstyle.display = "none";}
}
if(bt){
if(document.all( "msg1")。フィルター[2] .status == 1 || document.all( "msg1")。フィルター[2] .status == 0){
tooltipstyle.display = "none";}
}
if(!rt &&!bt)tooltipstyle.display = "none";
// ----------------------------
}
}
else // show
{
if(!fg)fg = "#777777";
if(!bg)bg = "#eeeeee";
var content =
'<table id = "msg1" name = "msg1" cellspacing = "0" cellpadding = "1" bgcolor = "' + fg + '"> <td>' +
'<Table CellSpacing = "2" CellPadding = "3" bgcolor = "' + bg +
'"> <td> <font face =" arial "color ="' + fg +
'"size =" -2 ">' + msg +
'</font> </td> </table> </td> </table>';
if(ns4)
{
tooltipstyle.document.write(content);
tooltipstyle.document.close();
tooltipstyle.visibility = "visible";
}
if(ns6)
{
document.getElementById( "ToolTiplayer")。innerhtml = content;
tooltipstyle.display = 'block'
}
if(ie4)
{
document.all( "tooltiplayer")。innerhtml = content;
tooltipstyle.display = 'block'
//-图象过渡、淡入处理 -
var cssopaction = document.all( "msg1")。フィルター[0] .opacity
document.all( "MSG1")。フィルター[0] .Opacity = 0;
if(rt)document.all( "msg1")。filters [1] .apply();
if(bt)document.all( "msg1")。filters [2] .apply();
document.all( "msg1")。フィルター[0] .opacity = cssopaction;
if(rt)document.all( "msg1")。filters [1] .play();
if(bt)document.all( "msg1")。filters [2] .play();
// ----------------------------
}
}
} catch(e){}
}
関数movetomouseloc(e)
{
var scrolltop = getScrolltop();
var scrollleft = getScrollleft();
if(ns4 || ns6)
{
x = e.pagex + scrollleft;
y = e.pagey -scrolltop;
}
それ以外
{
x = event.clientx + scrollleft;
y = event.clienty;
}
if(x-scrollleft> getViewPortWidth() / 2){
x = x -document.getElementById( "ToolTiplayer")。offsetWidth -2 * offsetx;
}
if((y+document.getElementById( "ToolTiplayer")。offsetheight+offsety)> getViewPortheight()){
y = getviewportheight() - document.getElementById( "ToolTiplayer")。
}
tooltipstyle.left =(x + offsetx) + 'px';
tooltipstyle.top =(y + offsety + scrolltop) + 'px';
trueを返します。
}
inittooltips();
主页面:
引入index.css
复制代码代码如下:
<link href = "css/index.css" rel = "styleSheet" type = "text/css"/>
<body style = "text-align:center">
<div>
<ul>
<li>
<div> <a href = "http://www.lanrentuku.com/"ターゲット= "_ blank"> <img src = 'images/2009511956153474660_small.jpg' onmouseover = "tooltip( '<img = images/20091959615460.jpg.jpg.Jpg onmouseout = "tooltip()"> </a> </div>
</li>
<li>
<div> <a href = "http://www.lanrentuku.com/"ターゲット= "_ blank"> <img src = 'images/2009551813457815940_small.jpg' onmouse = "tooltip( '<img src = images/2009551813457815940.jpg> ') "onmouseout =" tooltip() "> </a> </div>
</li>
</ul>
</div>
tooptip.js
复制代码代码如下:
<スクリプト言語= "javascript" src = "js/tooltip.js"> </script>
</body>
</html>
index.css:
复制代码代码如下:
/*首页*/
html {オーバーフロー:-moz-scrollbars-vertical; } /*は常にFirefox Scrollbarを表示します* /
body {font:12px/22px "宋体";ワードブレイク:ブレークオール;テキストアライグ:左;背景:#C0C0C0;色:#4e4e4e;}
ul、li {list-style:none;}
{color:#333;テキストデカレーション:なし;}
A:Hover {color:#ff722d;テキストデカレーション:なし;}
IMG {Border:0;}
A IMG、a:Hover IMG {border:0;}
.latestweb {width:980px;マージン:10px auto 0;}
.latestweb ul {overflow:hidden; _height:1%;}
.latestweb li {float:left;境界線:1px solid #ebeaea;幅:150px;パディング:10px;マージン:14px 14px 0 0; }
.trans_msg {filter:alpha(ofacity = 100、enabled = 1)revealtrans(duration = .2、transition = 1)blendtrans(duration = .2);}
div.bodycontent {font-family:arial、helvetica、sans-serif; padding:0 10px 10px 13px; color:#555; line-height:22px; text-align:justify; text-justify:inter-idograph;}
div.bodycontent ul {margin-left:0px}