Andy H.
|
| Posted: 07/08/2003, 6:48 PM |
|
I'm using CC Studio and have developed a menu with java script that I would like applied across the top of each page in my application. This is probably very simple, but I cannot figure it out. Can anyone tell me what the best way to do this is?
Thanks
|
|
|
 |
glerma
|
| Posted: 07/10/2003, 10:50 AM |
|
Create a header page with your Javascript code in it and make it includable. Then include the header page on all of the other pages.
|
|
|
 |
Frans
|
| Posted: 07/11/2003, 4:38 AM |
|
Here is it. If you are using Codecharge put it in the header of the page or if you are using Studio you can INCLUDE it in the pages you want.
For style propertys put the following code in the head of the page
<STYLE TYPE="text/css">
<!--
.menuh {
BORDER-COLOR : #FFFF99 ;
cursor : hand ;
Border-Left : #FFFF99 ;
Border-Top : #FFFF99 ;
Padding-Left : 1px ;
Padding-Top : 1px ;
Background-Color : #FFFF99 ;
}
.menu {
Background-Color : white ;
}
.home {
cursor : hand ;
}
.menulinks{
text-decoration:none;
}
//-->
</STYLE>
This is the actual menu
<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=770
var offsettop=30
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:black;"><TABLE BORDER="1" width="'+menuwidth+'" CELLPADDING="0" CELLSPACING="0" BORDERCOLOR="black" bgcolor="white">')}
else if (ns4){ document.write('<LAYER top="20" name="object1" left="'+offsetleft+'" BGCOLOR=black><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="#3399FF" BORDERCOLORDARK="#99CCFF" BORDERCOLORLIGHT="#003399"><P ALIGN=CENTER><FONT SIZE="4" 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]="menu1";
menui[1]="menu2";
menui[2]="menu3";
menui[3]="menu4";
menui[4]="menu5";
menui[5]="menu6";
menui[6]="menu7";
menui[7]="menu8";
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="white" ONCLICK="location=''+menul+''" onmouseover="className='menuh'" onMouseout="className='menu'"><CENTER><FONT>'+menui+'</FONT></TD></TR>')}
else if (ns4){document.write('<TR><TD BGCOLOR="white"><ILAYER><LAYER width="'+menuwidth+'" onmouseover="bgColor='yellow'" onmouseout="bgColor='white'"><CENTER><A HREF="'+menul+'" class=menulinks>'+menui+'</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>
|
|
|
 |
|