webForumDet fria alternativet

länka Javascript

6 svar · 403 visningar · startad av pellsäter

pellsäterMedlem sedan aug. 2000533 inlägg
#1

<script language="JavaScript1.2" src="menus.js"></script>

ANvädnder ovan för att ha med ett meny från Bratta men den funkar inte då.. utan bara när jag lägger in hela koden i filen.. varför har jag skrivit fel?

PepeJeriaMedlem sedan feb. 2003779 inlägg
#2

Ser rätt ut, stämmer sökvägen? Prova med att sätta en alert i menus.js.

Skulle själv ändra till detta dock:

<script type="text/javascript" src="menus.js"></script>
pellsäterMedlem sedan aug. 2000533 inlägg
#3

fick följnade fel nu
'makeCoolmenu' odefinierad... klistrar in hela koden för ajg hittar inte felet... det funkar när jag har den direkt i sidan

här är menu.js som den heter!!!

function lib_bwcheck(){ //Browsercheck (needed)
	this.ver=navigator.appVersion; this.agent=navigator.userAgent
	this.dom=document.getElementById?1:0
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0;
	this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom)?1:0;
	this.ie4=(document.all && !this.dom)?1:0;
	this.ie=this.ie4||this.ie5||this.ie6
	this.mac=this.agent.indexOf("Mac")>-1
	this.opera5=this.agent.indexOf("Opera 5")>-1
	this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0; 
	this.ns4=(document.layers && !this.dom)?1:0;
	this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5 || this.dom)
	return this
}
var bw=new lib_bwcheck() //Making browsercheck object

var mDebugging=2 //General debugging variable. Set to 0 for no debugging, 1 for alerts or 2 for status debugging.

oCMenu=new makeCoolMenu("oCMenu") //Making the menu object. Argument: menuname
oCMenu.useframes=0 //Do you want to use the menus as coolframemenu or not? (in frames or not) - Value: 0 || 1
oCMenu.frame="1" //The name of your main frame (where the menus should appear). Leave empty if you're not using frames - Value: "main_frame_name"

oCMenu.useNS4links=1 

oCMenu.NS4padding=2 

oCMenu.checkselect=1

oCMenu.offlineUrl="file:///C|/Inetpub/wwwroot/dhtmlcentral/" //Value: "path_to_menu_file_offline/"
//The onlineUrl variable is the online path to your script. Place in the full path to where your js file is. Remember to end with a slash.
oCMenu.onlineUrl="http://www.fitnessbutiken.se" //Value: "path_to_menu_file_online/"

oCMenu.pagecheck=1 
oCMenu.checkscroll=1
oCMenu.resizecheck=1 
oCMenu.wait=1000 

oCMenu.usebar=0 
oCMenu.barcolor="white" 
oCMenu.barwidth="menu" 
oCMenu.barheight="menu" 
oCMenu.barx=300
oCMenu.bary=50 
oCMenu.barinheritborder=0 1

oCMenu.rows=1
oCMenu.fromleft=300 
oCMenu.fromtop=55 
oCMenu.pxbetween=0 

oCMenu.menuplacement=0

oCMenu.menuplacement="bottom"

Choose one of those options to get the desired results.
*/
oCMenu.menuplacement=new Array(200,270,340)

//TOP LEVEL PROPERTIES - ALL OF THESE MUST BE SPESIFIED FOR LEVEL[0]
oCMenu.level[0]=new Array() //Add this for each new level
oCMenu.level[0].width=100 //The default width for each level[0] (top) items. You can override this on each item by spesifying the width when making the item. - Value: px || "%"
oCMenu.level[0].height=20 //The default height for each level[0] (top) items. You can override this on each item by spesifying the height when making the item. - Value: px || "%"
oCMenu.level[0].bgcoloroff="CC3300" //The default background color for each level[0] (top) items. You can override this on each item by spesifying the backgroundcolor when making the item. - Value: "color"
oCMenu.level[0].bgcoloron="#CC3300" //The default "on" background color for each level[0] (top) items. You can override this on each item by spesifying the "on" background color when making the item. - Value: "color"
oCMenu.level[0].textcolor="#FFFFFF" //The default text color for each level[0] (top) items. You can override this on each item by spesifying the text color when making the item. - Value: "color"
oCMenu.level[0].hovercolor="#FFFFFF" //The default "on" text color for each level[0] (top) items. You can override this on each item by spesifying the "on" text color when making the item. - Value: "color"
oCMenu.level[0].style="padding:2px; font-family:tahoma,arial,helvetica; font-size:12px; font-weight:bold" //The style for all level[0] (top) items. - Value: "style_settings"
oCMenu.level[0].border=0 //The border size for all level[0] (top) items. - Value: px
oCMenu.level[0].bordercolor="red" //The border color for all level[0] (top) items. - Value: "color"
oCMenu.level[0].offsetX=11 //The X offset of the submenus of this item. This does not affect the first submenus, but you need it here so it can be the default value for all levels. - Value: px
oCMenu.level[0].offsetY=-1 //The Y offset of the submenus of this item. This does not affect the first submenus, but you need it here so it can be the default value for all levels. - Value: px
oCMenu.level[0].NS4font="verdana"
oCMenu.level[0].NS4fontSize="1"
/*And last but not least the align variable.

This spesifies how the submenus of this level comes out. 
Values:
"bottom": The sub menus of this level will come out on the top of this item
"top": The sub menus of this level will come out on the bottom of this item
"left": The sub menus of this level will come out on the right of this item
"right": The sub menus of this level will come out on the left of this item

In generally "left" and "right" works best for menus in columns and "top" and "bottom" works best for menus in rows. 
But by all means feel free to play with it.

If you have set pagecheck to 1 above this is what the pagecheck will change when reaching the bounderies of the page.
If it reaches the right boundery and it's aligned left it will change the align to right and so on.
*/
oCMenu.level[0].align="bottom" //Value: "top" || "bottom" || "left" || "right" 

//EXAMPLE SUB LEVEL[1] PROPERTIES - You have to spesify the properties you want different from LEVEL[0] - If you want all items to look the same just remove this
oCMenu.level[1]=new Array() //Add this for each new level (adding one to the number)
oCMenu.level[1].width=137
oCMenu.level[1].height=15
oCMenu.level[1].style="padding:3px; font-family:verdana, arial,helvetica; font-size:9px; font-weight:normal"
oCMenu.level[1].align="bottom" 
oCMenu.level[1].offsetX=-(oCMenu.level[0].width-2)/2+20
oCMenu.level[1].offsetY=0
oCMenu.level[1].border=0
oCMenu.level[1].bordercolor="#990000"

//EXAMPLE SUB LEVEL[2] PROPERTIES - You have to spesify the properties you want different from LEVEL[1] OR LEVEL[0] - If you want all items to look the same just remove this
oCMenu.level[2]=new Array() //Add this for each new level (adding one to the number)
oCMenu.level[2].width=oCMenu.level[0].width
oCMenu.level[2].height=20
oCMenu.level[2].bgcoloroff="#009999"
oCMenu.level[2].bgcoloron="#CC3300"
oCMenu.level[2].style="padding:2px; font-family:tahoma,arial,helvetica; font-size:10px; font-weight:bold"
oCMenu.level[2].align="bottom" 
oCMenu.level[2].offsetX=0
oCMenu.level[2].offsetY=0
oCMenu.level[2].border=1 
oCMenu.level[2].bordercolor="#990000"
oCMenu.level[2].NS4font="tahoma,arial,helvetica"
oCMenu.level[2].NS4fontSize="1"

/*Variables for each menu item: (** means that they have to be spesified!)
name: The name of the item. This must be unique for each item. Do not use spaces or strange charachters in this one! **
parent: The name of the menuitem you want this to "connect" to. This will be a submenu of the item that have the name you place in here. ** for all other then the topitems
text: The text you want in the item. ** (except if you use images) 
link: The page you want this item to link to.
target: The target window or frame you want the link to go to (Default is same window if you're not using frames, and the mainframe if you're using frames)
width: The width of the element. If not spesified it will get the default width spesified above.
height: The height of the element. If not spesified it will get the default height spesified above.
img1: The "off" image for element if you want to use images.
img2: The image that appears onmouseover if using images.
bgcoloroff: The background color for this item. If not spesified it will get the default background color spesified above.
bgcoloron: The "on" background color for this item. If not spesified it will get the default "on" background color spesified above.
textcolor: The text color for this item. If not spesified it will get the default text color spesified above.
hovercolor: The "on" text color for this item. If not spesified it will get the default "on" text color spesified above. Netscape4 ignores this
onclick: If you want something to happen when the element is clicked (different from going to a link) spesifiy it here.
onmouseover: This will happen when you mouseover the element. Could be status text, another imageswap or whatever.
onmouseout: This will happen when you mouseout the element.

Remember you can have as many levels/sublevels as you want. Just make sure you spesify the correct "parent" for each item.
To set styles for each level see above.
*/

oCMenu.makeMenu('top0','','','korgen_test.asp?andra=visainnehall','',0,0,'images/kundkorg_knapp.gif','images/kundkorg_knapp.gif')

oCMenu.makeMenu('top1','','','','',0,0,'images/info_knapp2.gif','images/info_knapp2.gif')
	oCMenu.makeMenu('sub01','top1','Kontakt','')
	oCMenu.makeMenu('sub02','top1','Företaget','')
	oCMenu.makeMenu('sub03','top1','Fraktinfo.','')
	oCMenu.makeMenu('sub04','top1','Garanti','')

oCMenu.makeMenu('top2','','','','',0,0,'images/info_knapp2.gif','images/info_knapp2.gif')
	oCMenu.makeMenu('sub05','top2','Erbjudande','')
	oCMenu.makeMenu('sub06','top2','Paketpriser','')
	oCMenu.makeMenu('sub07','top2','Top 10','')
	oCMenu.makeMenu('sub08','top2','Nyheter','')
	

		
		
//Leave these two lines! Making the styles and then constructing the menu
oCMenu.makeStyle(); oCMenu.construct()
Jesper TMedlem sedan nov. 20017 058 inlägg
#4

Huumm...Pellsäter som har snart fem hundra inlägg borde ha lärt sig att lägga koden inom [kod]-taggar. :)

Jesper TMedlem sedan nov. 20017 058 inlägg
#5

Först så skriver du menus.js i länken och sedan så säger du att scriptsidan heter menu.js

pellsäterMedlem sedan aug. 2000533 inlägg
#6

ok...

du menar att man ska skriva [ innan all kod och sedan] efter all kod.....

jag skrev i koden
"här är menu.js som den heter!!!" för att markera att det är så den heter och inte menus.js

hur som helst så funkar det inte som det är

pellsäterMedlem sedan aug. 2000533 inlägg
#7

har fått löst så att menyny funkar... MEN den "följer med" nä rjag scrollar sidan... det vill jag inte.. går det att låsa fast den

210 ms totalt · 3 externa anrop · cache AV · v20260731051352-full.56cc9887
0 ms — hämta statistik (cache)
133 ms — hämta forumlista (db)
208 ms — hämta tråd, inlägg och bilagor (db)