制作在状态栏动态提示超链接地址的效果

时间:2010-04-15 12:17:32  来源:第二电脑网  作者:第二电脑网

  第二电脑网导读:Script"><!-- Beginvar data = "0123456789";var done = 1;function statusIn(text) {decrypt(text, 2, 1);}function statusOut() {self.status = '';done = 1;}function decrypt(text, max, delay) {if (done) {done = 0;decrypt_helper(text, max, delay, 0, m...
  正文:一般我们将鼠标移到超链接,IE浏览器的状态栏会出现该链接的详细地址。这篇文章,介绍是如何制作在状态栏动态提示超链接地址的效果,动态效果非常眩。

制作方法:
在<body>中插入JavaScript代码
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var data = "0123456789";
var done = 1;
function statusIn(text) {
decrypt(text, 2, 1);
}

function statusOut() {
self.status = '';
done = 1;
}

function decrypt(text, max, delay) {
if (done) {
done = 0;
decrypt_helper(text, max, delay, 0, max);
}
}
function decrypt_helper(text, runs_left, delay, charvar, max) {
if (!done) {
runs_left = runs_left - 1;
var status = text.substring(0, charvar);
for (var current_char = charvar; current_char < text.length; current_char++) {
status += data.charAt(Math.round(Math.random()*data.length));
}
window.status = status;
var rerun = "decrypt_helper('" + text + "'," + runs_left + "," + delay + "," + charvar + "," + max + ");"
var new_char = charvar + 1;
var next_char = "decrypt_helper('" + text + "'," + max + "," + delay + "," + new_char + "," + max + ");"
if(runs_left > 0) {
setTimeout(rerun, delay);
}
else {
if (charvar < text.length) {
setTimeout(next_char, Math.round(delay*(charvar+3)/(charvar+1)));
}
else {
done = 1;
}
}
}
}
// End -->
</script>

在有超链接处,加入代码:
onMouSEOver="statusIn('Goto:[http://www.webjx.com/]');return true;" onMouseOut="statusOut();"
红色代码处为超链接的动态提示效果,你可以做相应的变动。
整个代码为:
<a href="http://www.webjx.com/"
onMouseOver="statusIn('Goto:[http://www.webjx.com/]');return true;"
onMouseOut="statusOut();" target="_blank">网页教学网</a> "制作在状态栏动态提示超链接地址的效果"由第二电脑网原创提供,转载请注明:http://www.002pc.com/master/College/Programming/JavaScript/13653.html


关键字:

关于《制作在状态栏动态提示超链接地址的效果》文章的评论

站内搜索: 高级搜索

热门搜索: Windows style 系统 tr IP QQ CPU 安装 function 注册 if td