Javascript controllable spiral menu Rotation
Last Update:2018-12-04
Source: Internet
Author: User
<HTML>
<Head>
<Title> Search </title>
<Meta http-equiv = "Content-Type" content = "text/html; charset = gb2312">
<! -- Add the following code between <SCRIPT type = "text/JavaScript">
Eye = {P: 0, x: 0, Y: 0, W: 0, H: 0, R: 0, V: 0, S: 0, isvertical: 0, a1: 0, A2: 0, A3: 0, color: '# ffff', colorover:' # ffffff', backgroundcolor: '# 0099ff', backgroundcolorover: '#000000 ', bordercolor: '#000000', fontsize: 12, fontfamily: 'arial', PAS: 0, spinmenu: function () {This. P = This. r/This. s; this. a1 = This. a2 = This. isvertical? 0: math. PI/2}, spinmenuitem: function (A7, A6, A5) {A4 = "onclick = 'window. open (/"" + A6 + "/" "+ (A5? (",/" "+ A5 +"/""): ",/" _ Self/"") + ") '"; document. write ("<Div id = 'spinmenu" + this. a3 + "'style = 'cursor: pointer; cursor: expression (/" hand/"); position: absolute; width:" + this. W + "PX; left:" + this. H + "PX;" + "background-color:" + this. backgroundcolor + "; color:" + this. color + "; Border: 1px solid" + this. bordercolor + "; Font: normal" + this. fontsize + "PX" + this. fontfamily + "; text-align: center; cursor: default; Z-index: 1000; 'onmouseover = 'This. style. color =/"" + this. colorover + "/"; this. style. backgroundcolor =/"" + this. backgroundcolorover + "/" '"+" onmouseout = 'this. style. color =/"" + this. color + "/"; this. style. backgroundcolor =/"" + this. backgroundcolor + "/" '"+ A4 +"> "+ A7 +" </div> "); this. a3 ++}, Muta: function () {A8 = document. getelementbyid ("controale"); for (I = 0; I <this. a3; I ++) {A9 = document. getelementbyid ("spinmenu" + I + ""); a9s = a9.style; If (this. isvertical) {x I = parseint (this. R * Math. cos (this. a1 + I * This. PAS)/This. s; YI = parseint (this. R * Math. sin (this. a1 + I * This. PAS); A10 = (this. P + XI)/(2 * This. p); A11 = This. fontsize * (this. P + XI)/(2 * This. p) + 2; A12 = parseint (100 * (this. P + XI)/(2 * This. p)} else {xi = parseint (this. R * Math. cos (this. a1 + I * This. PAS); YI = parseint (this. R * Math. sin (this. a1 + I * This. PAS)/This. s; A10 = (this. P + yi)/(2 * This. p); A11 = This. fontsize * (this. P + yi)/(2 * This. p) + 2; A12 = P Arseint (100 * (this. P + yi)/(2 * This. p)}; A13 = (this. w-20) * A10 + 20; A14 = (this. h-20) * A10 + 10; a9s. top = (yi + this. y-a14/2) + "PX"; a9s. left = (XI + this. x-a13/2) + "PX"; a9s. width = A13 + "PX"; a9s. fontsize = A11 + "PX"; a9s. zindex = A12}; a8.style. top = This. Y + (this. isvertical? This. R: This. p) + this. h/2 + 6; a8.style. Left = This. x-a8.offsetWidth/2; If (this. A1! = This. A2) {This. A1 = (this. A1> This. A2 )? (This. a1-this.pas/This. v) :( this. a1 + this. PAS/This. v); If (math. ABS (this. a1-this.a2) <this. PAS/This. v)
This. a1 = This. a2; setTimeout ("Eye. muta () ", 10) }}, spinmenuclose: function () {This. PAS = 2 * Math. PI/This. a3; document. write ('<Div id = "controale" style = "position: absolute"> <button type = "" onclick = "Eye. a2 + = eye. PAS; eye. muta () "onfocus =" this. blur () "> </button> <button type =" "onclick =" Eye. a2-= eye. PAS; eye. muta () "onfocus =" this. blur () ">>></button> </div> '); eye. muta ()}};
Function getposoffset (what, offsettype) {var totaloffset = (offsettype = "Left ")? What. offsetleft: What. offsettop; var parentel = What. offsetparent; while (parentel! = NULL) {totaloffset = (offsettype = "Left ")? Totaloffset + parentel. offsetleft: totaloffset + parentel. offsettop; parentel = parentel. offsetparent;} return totaloffset;
}
</SCRIPT>
<Body>
<! -- Add the following code to the <body> and </body> -->
<Table border = "0" cellpadding = "0" cellspacing = "0">
<Tr>
<TD align = "center">
<SCRIPT type = "text/JavaScript">
Eye. isvertical = 0; // if it's vertical or horizontal [0 | 1]
Eye. x = 390; // left margin
Eye. Y = 150; // top margin
Eye. W = 180; // width
Eye. H = 30; // height
Eye. r = 100; // menu spacing
Eye. V = 20; // menu movement speed
Eye. S = 8; // scale in space (for 3D effect)
Eye. Color = '# ffff'; // normal text color
Eye. colorover = '# ffff'; // Mouseover text color
Eye. backgroundcolor = '# 0099ff'; // normal background color
Eye. backgroundcolorover = '#990000'; // Mouseover background color
Eye. bordercolor = '#000000'; // border color
Eye. fontsize = 12; // font size
Eye. fontfamily = 'arial'; // font family
If (document. getelementbyid ){
Document. Write ('<Div id = "spinanchor" style = "height:' + eval (eye. H + 20) + '"> </div> ')
Eye. Anchor = Document. getelementbyid ('fig ')
Eye. spinmenu ();
Eye. x + = getposoffset (eye. Anchor, "Left") // relatively position it
Eye. Y + = getposoffset (eye. Anchor, "TOP") // relatively position it
// Menuitem: Eye. spinmenuitem (text, Link, target)
Eye. spinmenuitem ("website creation service ","#");
Eye. spinmenuitem ("spatial domain name ","#");
Eye. spinmenuitem ("webpage tutorial ","#");
Eye. spinmenuitem ("webpage effects ","#");
Eye. spinmenuitem ("webpage material ","#");
Eye. spinmenuitem ("website promotion ","#");
Eye. spinmenuclose ();
}
</SCRIPT>
</TD>
</Tr>
</Table>
</Body>
</Html>