...

View Full Version : using javascript to statically place objects



hustla21519
06-02-2003, 09:00 PM
yeah.... i know, im supposed to search javascriptkit.com. well i did, thats where the problem comes in. i got the code for statically placing objects, and im trying to use the "spinmenu.js" but the three codes dont seem to be collaborating. ive been working on this since 6:00pm central time yesterday, and i needed it then too. ive tried all the variables that my mouse could muster. could somebody point me in the right direction?

heres the code im "trying" to use:
dosc:

<script language="JavaScript1.2">
document.write("Your browser\'s dimensions are: ")
//if browser supports window.innerWidth
if (window.innerWidth)
document.write(window.innerWidth+" by "+window.innerHeight)
//else if browser supports document.all (IE 4+)
else if (document.all)
document.write(document.body.clientWidth+" by "+document.body.clientHeight)

</script>


variables for banner:

<div id="staticbanner" style="position:absolute;">
Advertisement<br>
<a href="http://test.htm"><img
src="test.gif" width="120" height="90" alt="Click here!"
border="0"></a>
</div>

<script>
//define universal reference to "staticbanner"
var crossobj=document.all? document.all.staticbanner : document.getElementById? document.getElementById("staticbanner") : document.staticbanner

function positionit(){
//define universal dsoc left point
var dsocleft=document.all? document.body.scrollLeft : pageXOffset
//define universal dsoc top point
var dsoctop=document.all? document.body.scrollTop : pageYOffset
//define universal browser window width
var window_width=document.all? document.body.clientWidth : window.innerWidth

//if the user is using IE 4+ or NS6+
if (document.all||document.getElementById){
crossobj.style.left=parseInt(dsocleft)+
parseInt(window_width)-135
crossobj.style.top=dsoctop+5
}
//else if the user is using NS 4
else if (document.layers){
crossobj.left=
dsocleft+window_width-140
crossobj.top=dsoctop+15
}
}
setInterval("positionit()",200)
</script>

hustla21519
06-02-2003, 09:30 PM
and heres the spinmenu from javascriptkit:

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

<body>
<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 = 500; // x offset from point of insertion on page
eye.y = 250; // 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.anchor=document.getElementById('spinanchor')
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("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/");
eye.spinmenuclose();
}
</script>

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

</body></embed>


i dont want anybody to do it for me, i just figured itd be alot easier to diagnose the problem if you could see the script
thanks



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum