View Full Version : spinmenu javascript, one tiny error, need help.

07-10-2003, 03:29 AM
I recently did up a page with this script (already uploaded the necessary .js file to my server B.T.W.):

<!--Step 1: Add the below SCRIPT to the head of your page:-->
<script type="text/javascript" src="spinmenu.js"></script>

<p>Example Spin Menu:</p>

<!--Step 2: Add the below SCRIPT to the body of your page where you want it to appear:-->

<script type="text/javascript">

3D Spin Menu- By Petre Stefan (http://www.eyecon.ro) w/ changes by JK
Visit JavaScript Kit (http://www.javascriptkit.com) for script
Keep this notice intact!

eye.isVertical = 0; //if it's vertical or horizontal [0|1]
eye.x = 150; // x offset from point of insertion on page
eye.y = 0; // y offset from point of insertion on page
eye.w = 150; // item's width
eye.h = 30; // height
eye.r = 100; // menu's radius
eye.v = 20; // velocity
eye.s = 8; // scale in space (for 3D effect)
eye.color = '#ffffff'; // normal text color
eye.colorover = '#ffffff'; // 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.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("JavaScript Kit","http://www.javascriptkit.com");
eye.spinmenuitem("Free JavaScripts","http://www.javascriptkit.com/cutpastejava.shtml");
eye.spinmenuitem("JS Tutorials","http://www.javascriptkit.com/javaindex.shtml");
eye.spinmenuitem("Advanced JS Tutorials","http://www.javascriptkit.com/javatutors/");
eye.spinmenuitem("DHTML/ CSS Tutorials","http://www.javascriptkit.com/dhtmltutors/index.shtml");
eye.spinmenuitem("Web building tutorials","http://www.javascriptkit.com/howto/");

<p align="left"><font face="arial" size="-2">This free script provided by<br>
<a href="http://javascriptkit.com">JavaScript Kit</a></font></p>


But I then made some changes to my site most notably this:

<script LANGUAGE="JavaScript"><!--
// Preload and play audio files with event handler (MouseOver sound)
// designed by JavaScript Archive, (c)1999
// Get more free javascripts at http://jsarchive.8m.com

var aySound = new Array();
aySound[1] = "http://mysite.com/sounds/appreciate.wav";
// DO NOT edit below this line
document.write('<BGSOUND ID="auIEContainer">')
IE = (navigator.appVersion.indexOf("MSIE")!=-1 && document.all)? 1:0;
NS = (navigator.appName=="Netscape" && navigator.plugins["LiveAudio"])? 1:0;
ver4 = IE||NS? 1:0;

function auPreload() {
if (!ver4) return;
if (NS) auEmb = new Layer(0,window);
else {
Str = "<DIV ID='auEmb' STYLE='position:absolute;'></DIV>";
var Str = '';
for (i=0;i<aySound.length;i++)
Str += "<EMBED SRC='"+aySound[i]+"' AUTOSTART='FALSE' HIDDEN='TRUE'>"
if (IE) auEmb.innerHTML = Str;
else {
auCon = IE? document.all.auIEContainer:auEmb;
auCon.control = auCtrl;
function auCtrl(whSound,play) {
if (IE) this.src = play? aySound[whSound]:'';
else eval("this.document.embeds[whSound]." + (play? "play()":"stop()"))
function playSound(whSound) { if (window.auCon) auCon.control(whSound,true); }
function stopSound(whSound) { if (window.auCon) auCon.control(whSound,false); }

to the HEAD, and this:

<p align="center"><a href="http://www.mysite.com" onMouseOver="playSound(1)" onMouseOut="stopSound(1)"><img src="../../mysite/images/button.gif" alt="Go Home" width="30" height="32"><BR><B><font size="1">Go Home</font></B></a></p>

to the BODY.

Script 1 (the one with the problem) I got off of Javascriptkit.
Both scripts work fine together except one small glitch where the spinmenu LEFT and RIGHT input buttons are off centered to the right when page loads and then when I click on either of the buttons it shifts normal centered. Any idea why the initial misalignment? I have no other script on the page, just images and text.

07-10-2003, 11:49 AM
hm... maybe some objects are positioned relative, not absolute, so if you insert other objects in body, positioned nomatter how, you have to modify the left and top position of some of them... or to make it absolute, for avoinding that....

07-10-2003, 05:06 PM
So what your saying is if I alter my x and y for the spin menue?
Is it a layout thing?

07-10-2003, 05:11 PM
I don't know for sure, I can not see that "spinmenu.js". What I am saying is that sometimes it happen so when use two or more scripts, or you insert other objects, if one of them uses relative positioning

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum