Avatar billede webbe Nybegynder
30. januar 2001 - 10:22 Der er 7 kommentarer og
1 løsning

Hvordan med links!?

Jeg har overtaget en fil bestående af en masse linier med javascript!

Der dannes tilsyneladende nogle links, men når man klikker på disse link får jeg følgende fejl:

A run time error has occurred!
Do You wish to dubug?

Line 568
Error: \'top[...].location\' i s not an object

Hvad betyder det og hvordan skal jeg rette det?

Det dokument der er fejl i er på 600 linier, så jeg er ikke meget for at poste hele koden her, men jeg kan sende den pr. e-mail hvis det er!
Men linie 568 (og linierne omkring) ser sådan her ud:

}   
    if(url){
        this.over=0; this.mout()
        if(target==\"main\") window.open(url)
        else if(target==\"_top\" || target==\"window\") top.location.href=url 
        else top[target].location.href = url
    }else if(fc){
        eval(fc)
    }

Avatar billede madsmm Nybegynder
30. januar 2001 - 10:25 #1
du kan desværre ikke regne med linienummer i en javascript fil :(
Avatar billede kee.... Nybegynder
30. januar 2001 - 10:28 #2
Ud fra din den fejlkode du skriver der, er det sansynligvis ikke i linje 568 fejlen skal findes, men helt i starten af dit script. Den fortæller jo at LOCATION ikke er et objekt. Altså fejlen ligger der hvor en funktion skal hentes :-)

Jeg tror bestemt ikke at der er nogle der har noget imod du poster hele scriptet herinde :0)
Avatar billede erikjacobsen Ekspert
30. januar 2001 - 11:43 #3
Det er tilsyneladende noget, der lever i rammer (frames). Kører du
det også sådan, og i givet fald har du da navngivet dine rammer rigtigt?
Avatar billede webbe Nybegynder
30. januar 2001 - 12:17 #4
kee....

Det er muligt....kender ikke ret meget til javascript, men som du siger, så ser det ud til jeg bliver nødt til at poste det hele....er derfor jeg afviste dit første svar, da det ikke hjælper mig meget.
Avatar billede webbe Nybegynder
30. januar 2001 - 12:18 #5
erikjacobsen:

Jeps....det bliver kørt i rammer......og rammerne er navngivet korrekt!
Avatar billede webbe Nybegynder
30. januar 2001 - 12:18 #6
Prepare....her er hele koden:

<html>
<head>
    <title>Menu</title>
<script language=\"JavaScript1.2\" type=\"text/javascript\">
/*******************************************************************************
Copyright (c) 1999 Thomas Brattli (www.bratta.com)

eXperience DHTML coolFrameMenus - Get it at www.bratta.com
Version Beta 1.0
This script can be used freely as long as all copyright messages are
intact.

Visit www.bratta.com/dhtml/scripts.asp for the latest version of the script.
*******************************************************************************/

/*****************************************************************************
Default browsercheck
******************************************************************************/
function checkBrowser(){
    this.ver=navigator.appVersion
    this.dom=document.getElementById?1:0
    this.ie5=(this.ver.indexOf(\"MSIE 5\")>-1 && this.dom)?1:0;
    this.ie4=(document.all && !this.dom)?1:0;
    this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0;
    this.ns4=(document.layers && !this.dom)?1:0;
    this.opera=!(this.ie5 || this.ie4 || this.ns4 || this.ns5) && this.dom
    this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5)
    return this
}
var bw=new checkBrowser()
</script>
<script language=\"JavaScript1.2\" src=\"coolframe.js\" type=\"text/javascript\"></script>
</head>
<body bgcolor=\"#000000\">
<script language=\"JavaScript1.2\" type=\"text/javascript\">
/*******************************************************************************
Copyright (c) 1999 Thomas Brattli (www.bratta.com)

eXperience DHTML coolFrameMenus - Get it at www.bratta.com
Version Beta 1.0
This script can be used freely as long as all copyright messages are
intact.

Visit www.bratta.com/dhtml/scripts.asp for the latest version of the script.
*******************************************************************************/

/*****************************************************************************
Main variables
******************************************************************************/
mDebugging=1 //Set to 0 for NO Debugging, set to 1 for alert debugging and set to 2 for status.

oCFMenu=new coolFrameMenu(\'oCFMenu\') //Making a new menu

oCFMenu.menuFrameName=\"frmMain\" //The name of your \"main\" frame
oCFMenu.startPage=\"main.asp\" //The first page to appear in the main frame (it\'s important that this is loaded after the menu is created!)
oCFMenu.maxsubs=10 //The max number of subs you will have
oCFMenu.maxsubs2=7 //The max number of sub2s you will have
oCFMenu.maxsubs3=7 //The max number of sub2s you will have

//Frametype:
// 0 = menu in left frame
// 1 = menu in right frame
// 2 = menu in top frame
// 3 = menu in bottom frame
oCFMenu.frametype=2
//NOTE: If your using 1 or 3 and expect to have scrollbars remember to set the subXplacement and subYplacement to suit the scrollbars.
//I was going to add an automatic check of that, but then I would have had to add more code in the main pages (a onload function)
//And I didn\'t want to do that

oCFMenu.pagecheck=1 //This is a check that will keep the submenus from going to far out! Only for top and bottom frame

oCFMenu.mainheight=20 //The height of the main menuitems in pixel or %
oCFMenu.mainwidth=130 //The width of the main menuitems  in pixel or %

oCFMenu.subwidth=oCFMenu.mainwidth //  The width of the submenus
oCFMenu.subheight=20 //The height if the subitems in pixel or %

oCFMenu.sub2width=oCFMenu.mainwidth // The width of the sub2menus in pixel or %
oCFMenu.sub2height=oCFMenu.subheight // The height if the sub2items in pixel or %

oCFMenu.sub3width=oCFMenu.mainwidth // The width of the sub3menus in pixel or %
oCFMenu.sub3height=oCFMenu.subheight // The height if the sub3items in pixel or %

oCFMenu.subXplacement=0 // Relative to the main item
oCFMenu.subYplacement=0 // Relative to the main item

oCFMenu.sub2Xplacement=oCFMenu.subwidth-30 // The X placement of the subsubmenus, relative to the sub item
oCFMenu.sub2Yplacement=5 // The Y placement of the subsubmenus, relative to the sub item

oCFMenu.sub3Xplacement=oCFMenu.sub2width-30 // The X placement of the subsubmenus, relative to the sub2 item
oCFMenu.sub3Yplacement=5 // The Y placement of the subsubmenus, relative to the sub2 item

oCFMenu.mainbgcoloroff=\'black\' //The backgroundcolor of the main menuitems
oCFMenu.mainbgcoloron=\'#666666\' //The backgroundcolor on mouseover of the main menuitems
oCFMenu.maintextcolor=\"white\" //The original text color
oCFMenu.mainhovercolor=\"silver\" //The color the text should change to when mouseovered. NOTE: Doesn\'t work in NS4

oCFMenu.subbgcoloroff=\'black\' //The backgroundcolor of the sub menuitems
oCFMenu.subbgcoloron=\'#666666\' //The backgroundcolor on mouseover of the sub menuitems
oCFMenu.subtextcolor=\"white\" //The original text color
oCFMenu.subhovercolor=\"silver\" //The color the text should change to when mouseovered. NOTE: Doesn\'t work in NS4

oCFMenu.sub2bgcoloroff=\'black\' //The backgroundcolor of the subsub menuitems
oCFMenu.sub2bgcoloron=\'#666666\' //The backgroundcolor on mouseover of the subsub menuitems
oCFMenu.sub2textcolor=\"white\" //The original text color
oCFMenu.sub2hovercolor=\"silver\" //The color the text should change to when mouseovered. NOTE: Doesn\'t work in NS4

oCFMenu.sub3bgcoloroff=\'black\' //The backgroundcolor of the subsub menuitems
oCFMenu.sub3bgcoloron=\'#666666\' //The backgroundcolor on mouseover of the subsub menuitems
oCFMenu.sub3textcolor=\"white\" //The original text color
oCFMenu.sub3hovercolor=\"silver\" //The color the text should change to when mouseovered. NOTE: Doesn\'t work in NS4

//Borders
oCFMenu.bordersize=0
oCFMenu.bordercolor=\"#666666\"
//NOTE: The border immplemtation isn\'t prefect. The width and placement of elements have nothing
//to say here, so play with the fromtop, fromleft, subXplacement et cetera to get the desired effect.

//Styles for the top menus! - Change the colors, padding and other styles in here!
oCFMenu.topstyle=\"font-family:verdana; font-size:10px; padding:2px;\"
//Styles for the submenus - Change the colors, padding and other styles in here!
oCFMenu.substyle=\"padding:2px; font-family:verdana; font-size:10px\"
//Styles for the sub2menus - Change the colors, padding and other styles in here!
oCFMenu.sub2style=\"padding:2px; font-family:verdana; font-size:10px\"
//Styles for the sub3menus - Change the colors, padding and other styles in here!
oCFMenu.sub3style=\"padding:2px; font-family:verdana; font-size:10px\"

//LEAVE THESE LINES
oCFMenu.makeStyle() //Writes out the style for the top menus
oCFMenu.makeFrameString() //Makes the string for the main frame


//Placement of the menuitems

//Example in %:
//oCFMenu.menuplacement=new Array(\"0%\",\"30%\",\"45%\",\"60%\",\"75%\",\"90%\") //Remember to make the arrays contain as many values as you have main menuitems

//Example in px: (remember to use the \' \' around the numbers)
//oCFMenu.menuplacement=new Array(10,200,300,400,500,600,700)

//Example right beside eachother (only adding the pxbetween variable)
oCFMenu.menuplacement=0

//If you use the \"right beside eachother\" you cant how many pixel there should be between each here
oCFMenu.pxbetween=0 //in pixel or %

//And you can set where it should start from the left here
oCFMenu.fromleft=5 //in pixel or %

//This is how much from the top the menu should be.
oCFMenu.fromtop=1 //in pixel or %


//Making a top element makeTop(TEXT,LINK,TARGET,WIDTH,FUNCTION)
//TEXT = the text that you want displayed inside the item
//LINK = The page you want the item to link to - Set to 0 or don\'t spesify if you don\'t want a link
//TARGET = The target for the link, set to _blank, frame_name, _top - Set to 0 or don\'t spesify if you don\'t want a target
//WIDTH = Here you can set an individual width for each top element. This is ONLY availble on the top elements
//FUNCTION = If you want some Javascript code to be executed when this item is clicked place it here
oCFMenu.makeTop(\'Nyt i VFF\',0,0,95) //MAIN 1
    oCFMenu.makeSub(\'Sidste nyt\')
    oCFMenu.makeSub(\'Næste...\')
        oCFMenu.makeSub2(\'Næste kamp\')
        oCFMenu.makeSub2(\'Næste modstander\')
    oCFMenu.makeSub(\'Sidste kamp\')   
       
oCFMenu.makeTop(\'Holdet\',0,0,95) //Main 2
    oCFMenu.makeSub(\'Spillerne\')
    oCFMenu.makeSub(\'Trænerne\',0,0,80)   
    oCFMenu.makeSub(\'Lederne\',0,0)   
    oCFMenu.makeSub(\'Holdopstilling\',0,0)

oCFMenu.makeTop(\'Statistik\',0,0,100) //Main 3
    oCFMenu.makeSub(\'Stillinger\')
        oCFMenu.makeSub2(\'Faxe kondi ligaen\')
        oCFMenu.makeSub2(\'UEFA Cup\')
    oCFMenu.makeSub(\'Formkurver\')   
    oCFMenu.makeSub(\'Fair Play\')
    oCFMenu.makeSub(\'Topscorer\')   
       
oCFMenu.makeTop(\'Om VFF\',\'main1.html\',\'_main\',95) //Main 4
    oCFMenu.makeSub(\'Historien\')
    oCFMenu.makeSub(\'Galleri\')
        oCFMenu.makeSub2(\'Kamp-Galleri\')
        oCFMenu.makeSub2(\'Person-Galleri\')
    oCFMenu.makeSub(\'Resultater\')   
    oCFMenu.makeSub(\'Rekorder\')
    oCFMenu.makeSub(\'Info\')
    oCFMenu.makeSub(\'Kontakt\')
    oCFMenu.makeSub(\'Vejviser\')
    oCFMenu.makeSub(\'Fanklubben\')
    oCFMenu.makeSub(\'Links\')

oCFMenu.makeTop(\'VFF Shop\',0,0,105) //Main 5

oCFMenu.makeTop(\'Sponsorer\',\'sponsorer.asp\',\'_main\',0,0,105) //Main 6

oCFMenu.makeTop(\'Links\',\'link.asp\',\'_main\',0,0,95)    //Main 7

   
//Leave these lines!
oCFMenu.construct()

//Setting the bottom page. This have to be done so that we are sure that the menus are built
//before we load the bottom page. If the page was resized we want to load the same page back into the frameset
searchtext=location.search
isresized=searchtext.lastIndexOf(\"resizedurl\")
if(isresized>-1){ //Get PAGE
    oCFMenu.startPage=\"http://\" + searchtext.substr(isresized+11,searchtext.length)
}
if(top[oCFMenu.menuFrameName])top[oCFMenu.menuFrameName].location.href=oCFMenu.startPage
</script>



</body>
</html>
Avatar billede kee.... Nybegynder
30. januar 2001 - 13:17 #7
I have no idea, for den virker faktisk hos mig...

:-(
Avatar billede webbe Nybegynder
19. februar 2001 - 10:52 #8
Lukker spørgsmålet og finde rpå noget andet!
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Vi tilbyder markedets bedste kurser inden for webudvikling

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester