PDA

View Full Version : Cant edit colors



Vanir
09-29-2004, 10:18 PM
This static script http://www.dynamicdrive.com/dynamicindex1/staticmenu3.htm

Im new to this so this bear with me.

I cant seem to be able to change the colors such as the background colors, the menu bar or when i move the mouse over it.

help would be greatly appreciated
thanks

Odin
09-30-2004, 01:55 AM
I'm not an expert so there may be something I missed, but try this.
The colour variables are in the javascript for you to edit, the only other thing you'll need to change is the CSS classes - make sure both 'Background-Color's are the same as the variables commented after.

Head section (You'll probably want to make Border-Color the same as Background-Color, or just remove the border colours altogether):

<STYLE TYPE="text/css">
<!--

.menuh {
cursor : hand ;
BORDER-COLOR : #FFFF99 ;
Border-Left : #FFFF99 ;
Border-Top : #FFFF99 ;
Padding-Left : 1px ;
Padding-Top : 1px ;
Background-Color : #FFFF99 ; // linkonmouseover
}
.menu {
Background-Color : #FFFFFF ; // linkcolor
}
.home {
cursor : hand ;
}

.menulinks{
text-decoration:none;
}
//-->
</STYLE>

Body section:

<SCRIPT Language="Javascript1.2">
<!--

/*
Static menu script II (By maXimus, maximus@nsimail.com, http://maximus.ravecore.com/)
Modified slightly/ permission granted to Dynamic Drive to feature script in archive
For full source, usage terms, and 100's more DHTML scripts, visit http://dynamicdrive.com
*/

//configure below variable for menu width, position on page
var menuwidth=110
var offsetleft=10
var offsettop=90

//color variables
var bordercolor='black'
var linkcolor='white'
var linkonmouseover='#FFFF99'
var linkfontcolor='black'
var menubgcolor='#3399FF'
var menuborderdark='#99CCFF'
var menuborderlight='#003399'
var menufontcolor='#000000'

var ns4=document.layers?1:0
var ie4=document.all?1:0
var ns6=document.getElementById&&!document.all?1:0

function makeStatic() {
if (ie4) {object1.style.pixelTop=document.body.scrollTop+offsettop}
else if (ns6) {document.getElementById("object1").style.top=window.pageYOffset+offsettop}
else if (ns4) {eval(document.object1.top=eval(window.pageYOffset+offsettop));}
setTimeout("makeStatic()",0);
}

if (ie4||ns6) {document.write('<span ALIGN="CENTER" ID="object1" STYLE="Position:absolute; Top:20; Left:'+offsetleft+'; Z-Index:5;cursor:hand;background-color:'+bordercolor+';"><TABLE BORDER="1" width="'+menuwidth+'" CELLPADDING="0" CELLSPACING="0" BORDERCOLOR="'+bordercolor+'" bgcolor="'+linkcolor+'">')}
else if (ns4){ document.write('<LAYER top="20" name="object1" left="'+offsetleft+'" BGCOLOR='+bordercolor+'><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="1"><TR><TD><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" width="'+menuwidth+'">')}

if (ie4||ns6||ns4)
document.write('<TR><TD BGCOLOR="'+menubgcolor+'" BORDERCOLORDARK="'+menuborderdark+'" BORDERCOLORLIGHT="'+menuborderlight+'"><P ALIGN=CENTER><FONT SIZE="4" COLOR="'+menufontcolor+'" FACE=ARIAL>Menu</FONT></TD></TR>')

var menui = new Array();
var menul = new Array();

//configure below for menu items. Extend list as desired

menui[0]="Dynamic Drive";
menui[1]="What\'s New?";
menui[2]="What\'s Hot?";
menui[3]="Message Forum";
menui[4]="FAQs";
menui[5]="Submit Script";
menui[6]="Link to us";
menui[7]="Email us";

menul[0]="http://dynamicdrive.com";
menul[1]="http://dynamicdrive.com/new.htm";
menul[2]="http://dynamicdrive.com/hot.htm";
menul[3]="http://wsabstract.com/cgi-bin/Ultimate.cgi";
menul[4]="http://dynamicdrive.com/faqs.htm";
menul[5]="http://dynamicdrive.com/submit.htm";
menul[6]="http://dynamicdrive.com/link.htm";
menul[7]="http://dynamicdrive.com/contact.htm";

for (i=0;i<=menui.length-1;i++)
if (ie4||ns6) {document.write('<TR><TD BORDERCOLOR="'+linkcolor+'" ONCLICK="location=\''+menul[i]+'\'" onmouseover="className=\'menuh\'" onMouseout="className=\'menu\'"><CENTER><font color="'+linkfontcolor+'">'+menui[i]+'</font></TD></TR>')}
else if (ns4){document.write('<TR><TD BGCOLOR="'+linkcolor+'"><ILAYER><LAYER width="'+menuwidth+'" onmouseover="bgColor=\''+linkonmouseover+'\'" onmouseout="bgColor=\''+linkcolor+'\'"><CENTER><A HREF="'+menul[i]+'" class=menulinks><font color="'+linkfontcolor+'">'+menui[i]+'</font></A></CENTER></LAYER></ILAYER></TD></TR>')}

if (ie4||ns6) {document.write('</TABLE></span>')}
else if (ns4){document.write('</TABLE></TD></TR></TABLE></LAYER>')}

function menu3(){
if (ns6||ie4||ns4)
makeStatic()
}

window.onload=menu3

//-->
</SCRIPT>

Vanir
10-03-2004, 09:31 PM
I tried the code you gave me but it doesnt work, when i look at the page it puts all the code on the webpage, maybe im missing a tag. Does it work for you?
thanks

Odin
10-03-2004, 09:41 PM
Yeah, it worked for me. If it's displaying the raw script maybe you missed the <script language="Javascript1.2"> and </script> tags? If not, try posting the URL.