被生活干了

无论你说的话多么傻逼,但我坚决捍卫你说话的权利

导航

tooltip的API

js:


doc:


javascript DHTML,ToolTips,~ javacscript 跨浏览器API

 

APIToolTips的内容可以是普通文本也可以是HTML:例如image。。

 

特性:

       几乎在所有的HTML元素上都可以呈现tooltip,只需要“onmouseover”,但是“onmouseout”不是必须的。

       你可以随心所欲地在"onmouseover"中加入函数,来使您的tooltip更加个性化;

      

实用性:

       除了一些极少数的浏览器,主流的浏览器都对其进行了支持Netscape 4, Gecko Browsers, IE 4, 5.0, 5.5 und 6.0, Opera 5, 6, 7

      

用法:

       1 <script language="JavaScript" type="text/javascript" src="wz_tooltip.js"></script>

      

       2 <a href="index.htm" onmouseover="return escape('Some text')">Homepage </a> 

                     注:在 onmouseover这个属性中,填入的文本遵循以下规则:必须使用实体,即:&quot=“; 特别注意

                     以下三种情况:& amp; == &amp;| & lt; ==  &lt(<); | & gt; == &gt(>);

                    

  3: Right: <a href="index.htm" onmouseover="return escape('Text with <img src=\'image.jpg\' width=\'60\'> image.')"> Homepage</a>

              Wrong: <a href="index.htm" onmouseover="return escape('Text with <img src="image.jpg" width="60">image.')"> Homepage</a> 

              

扩展功能:

       onmouseover="return escape(text1);"也可以这样调用: onmouseover="return escape(TooltipText());就是说可以传递函数指针;

       变量和函数必须包含在<body></body>.并且在你最后一个需要用tooltip的Element之后!

      

       下面这些函数可能会被传递给onmouseover:

 

Command

Effect

Example

This.T_ABOVE

tooltip放在鼠标的point上,同时this.T_OFFSETY 可以设置竖直方向上的偏移;

This.T_ABOVE=true;

This.T_BGCOLOR

Tooltip的背景颜色,必须用单引号括起来;

This.T_BGCOLOR=’#D3E3f6’;

This.T_BGIMG

Tooltip的背景图象;

this.T_BGIMG = ‘myimg.jpg’;

This.T_BORDERWIDTH

Tooltip 的边缘宽度,如果为0 ,则隐藏

this.T_BORDERWIDTH = 3 ;

 This.T_DELAY

Tooltip 显示的延迟时间;

this.T_DELAY = 4000;

This.T_FIX

tooltip锁定在方括号指定的xy坐标上;

this.T_FIX = [200,300];

This.T_FONTCOLOR

Tooltip的字体颜色

This.T_FONTCOLOR=”#993399”;

This.T_FONTFACE

Tooltip的字体

this.T_FONTFACE =’verdana,Geneva’;

This.T_FONTSIZE

Tooltip字体的大小

this.T_FONTSIZE=’30px’

This.T_FONTWEIGHT

重量 可用的值:‘normal’或者‘bold’;

this.T_FONTWEIGHT=’bold’

This.T_LEFT

Tooltip 是否在鼠标point的上方 值:true;

this.T_LEFT=true;

This.T_OFFSETX

以鼠标为基准,tooltip在水平方向的偏移量

this.T_OFFSETX = 32;

This.T_OFFSETY

以鼠标为基准,tooltip在竖直方向上的偏移量

this.T_OFFSETY = 32;

This.T_OPACITY

属性在OPERA中不支持,取值在0—100之间

this.T_OPACITY = 80;

This.T_PADDING

内间距:内容与边界的space

this.T_PADDING = 5;

This.T_SHADOWCOLOR

自动生成阴影,阴影的strength被自动设置成5px

this.T_SHADOWCOLOR = ‘CCAACC’

This.T_SHADOWWIDTH

阴影的宽度;

this.T_SHADOWWIDTH = 8;

This.T_STATIC

很想操作系统中的tooltip,不跟随鼠标;

this.T_STATIC = true;

This.T_STICKY

Tooltip停留在鼠标初始位置,不跟随鼠标

this.T_STICKY = true;

This.T_TEMP

设置一个时间间隔,第一次tooltip消失到第二次出现

this.T_TEMP = 3500;

This.T_TITLE

标题

this.T_TITLE = ‘sometiel’;

This.T_TITLECOLOR

标题颜色

This.T_TITLE=#ff6666’;

This.T_WIDTH

Tooltip 的宽度

this.T_TITLE = 200;

This.T_TEXTALIGN

对齐方式;取值为: rigtht, justify,left

This.T_REXTALIGN = ‘right’

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 





<a href="index.htm" onmouseover="this.T_WIDTH=200;this.T_FONTCOLOR='#003399';return escape('Blablah')"> Homepage</a>


posted on 2006-05-12 15:01  komazhang  阅读(892)  评论(1编辑  收藏  举报