这段代码为什么调不出来?文字围绕鼠标转

Posted 32岁学编程

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了这段代码为什么调不出来?文字围绕鼠标转相关的知识,希望对你有一定的参考价值。

<html>
<head>
<title>围绕鼠标转动的文字</title>
<meta charset="UTF-8"/>
<style>
body, td, div { font-family: Verdana; font-size: 9pt }
</style>
</head>
<body>

<script language="javascript">

var init= {
yourLogo: ‘上元网络欢迎你‘,
logoFont: ‘Arial‘,
logoSize: 9,
logoColor: ‘red‘,
logoWidth: 40,
logoHeight: 40,
logoSpeed: 0.03,


load: function () {
yourLogo = this.yourLogo.split(‘‘);
L = yourLogo.length;
Result = "<font face=" + this.logoFont + " style=‘font-size:" + this.logoSize + "pt‘ color=" + this.logoColor + ">";
TrigSplit = 360 / L;
br = (document.layers) ? 1 : 0;
if (br) {
for (i = 0; i < L; i++)
document.write(‘<layer name="ns‘ + i + ‘" top=0 left=0 width=14 height=14">‘ + Result + yourLogo[i] + ‘</layer>‘);
}
else {
document.write(‘<div id="outer" style="position:absolute;top:0px;left:0px"><div style="position:relative">‘);
for (i = 0; i < L; i++)
document.write(‘<div id="ie" style="position:absolute;top:0px;left:0px;width:14px;height:14px">‘ + Result + yourLogo[i] + ‘</div>‘);
document.write(‘</div></div>‘);
}
ypos = 0;
xpos = 0;
step = this.logoSpeed;
currStep = 0;
Y = new Array();
X = new Array();
Yn = new Array();
Xn = new Array();
for (i = 0; i < L; i++) {
Yn[i] = 0;
Xn[i] = 0;
}



function Mouse(evnt) {
ypos = (document.layers) ? evnt.pageY : event.y;
xpos = (document.layers) ? evnt.pageX : event.x;
}

(document.layers) ? window.onMouseMove = Mouse : document.onmousemove = Mouse;


function animateLogo() {

if (!br)outer.style.pixelTop = document.body.scrollTop;

for (i = 0; i < L; i++) {
var layer = (document.layers) ? document.layers[‘ns‘ + i] : ie[i].style;
layer.top = Y[i] + this.logoHeight * Math.sin(currStep + i * TrigSplit * Math.PI / 180);
layer.left = X[i] + this.logoWidth * Math.cos(currStep + i * TrigSplit * Math.PI / 180);

}
currStep -= step;
}

function Delay() {
for (i = L; i >= 0; i--) {
Y[i] = Yn[i] += (ypos - Yn[i]) * (0.1 + i / L);
X[i] = Xn[i] += (xpos - Xn[i]) * (0.1 + i / L);

}
animateLogo();
setTimeout(Delay, 20);
}

Delay();
}
}
window.onload = init.load();

// -->
</script>

<div>hello test</div>
</body>

</html>

以上是关于这段代码为什么调不出来?文字围绕鼠标转的主要内容,如果未能解决你的问题,请参考以下文章

Unity3d如何做到用鼠标点击一个物品可以在屏幕上出来设定好的文字

什么软件可以将文字转化成语音播放出来?

在eclipse中buildpath选项没有了怎么都调不出来

谁有鼠标经过文字时显示图片的代码?

超实用!文档小技巧:1秒图片转文字

javafx问题,在一个文本框内输入文字,在label里面显示出来,输入啥就显示啥,但是这段代码有问题