Vraag & Antwoord

Webprogrammeren & scripting

[javascript] link werkt niet

6 antwoorden
  • Ik ben met een pagina bezig maar het wil niet lukken wat ik wil :( [url=http://www.webmedia-international.com/~~test/index.htm]LINK[/url] Als je op link 1, 2, 3 of 4 drukt, dan schuift er van alles aan de kant (wat ook de bedoeling is) Daarna gebeurd er niets. Wat er mat gebeuren is dat in dat frame een andere pagina wordt geopend zoals je op link 5 drukt. Dit is de javascript: [code:1:7ebde8f349]var sequence=0; var link; HM_DOM = (document.getElementById) ? true : false; HM_NS4 = (document.layers) ? true : false; HM_IE = (document.all) ? true : false; HM_IE4 = HM_IE && !HM_DOM; // rotatie var car_teller = 0; var image_index = 0; image_list = new Array(); image_list[image_index++] = "../images/masker.gif"; image_list[image_index++] = "../images/jasje.gif"; image_list[image_index++] = "../images/xt423zz2.gif"; image_list[image_index++] = "../images/schild.gif"; image_list[image_index++] = "../images/xt423zz4.gif"; image_list[image_index++] = "../images/xt423zz3.gif"; image_list[image_index++] = "../images/hoedjes.gif"; image_list[image_index++] = "../images/prikstokjes.gif"; image_list[image_index++] = "../images/xt423zz4.gif"; image_list[image_index++] = "../images/xt423zz1.gif"; image_list[image_index++] = "../images/hoedjes.gif"; image_list[image_index++] = "../images/schild.gif" // Dreamweaver function isEven(x) { return (x%2)?false:true; } function MM_findObj(n, d) { //v4.01 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); if(!x && d.getElementById) x=d.getElementById(n); return x; } function MM_preloadImages() { //v3.0 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++) if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}} } function MM_swapImgRestore() { //v3.0 var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc; } function MM_swapImage() { //v3.0 var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3) if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];} } function rotateImage() { if (car_teller==12) { car_teller=0; } if (!isEven(car_teller)) { deze = MM_findObj('rechtsimg'); } else { deze = MM_findObj('linksimg'); } deze.src = image_list[car_teller]; car_teller++; setTimeout('rotateImage()', 2000); } function flevSlideDiv() { if (arguments.length < 4) {return;} var sD = arguments[0]; if (sD == "") {return;} var oD = eval("MM_findObj('" + sD + "')"); if (oD == null) {return;} var iNX = parseInt(arguments[1]), iNY = parseInt(arguments[2]), iS = parseInt(arguments[3]); var iPx = (arguments.length > 4) ? parseInt(arguments[4]) : 0; var iR = (arguments.length > 5) ? parseInt(arguments[5]) : 0; var iT = 10, sS = ""; if (!document.layers) {oD = oD.style;} if (oD.tT != null) {clearTimeout(oD.tT);} var iCX = parseInt(oD.left), iCY = parseInt(oD.top); if (iR != 0) { // relative return; } var iX = iNX, iY = iNY; if ((iCX != iNX) || (iCY != iNY)) { if (iPx > 0) { iT = iS; var iPxX = iPx, iPxY = iPx, iMX = Math.abs(iCX - iNX), iMY = Math.abs(iCY - iNY); if (iMX < iMY) {iPxY = (iMX != 0) ? ((iMY/iMX)*iPx) : iPx;} else {iPxX = (iMY != 0) ? ((iMX/iMY)*iPx) : iPx;} if (iPxX >= iMX) {iPxX = Math.min(Math.ceil(iPxX), iPx);} if (iPxY >= iMY) {iPxY = Math.min(Math.ceil(iPxY), iPx);} if ((iCX < iNX) && (iCX + iPxX < iNX)) {iNX = iCX + iPxX;} if ((iCX > iNX) && (iCX - iPxX > iNX)) {iNX = iCX - iPxX;} if ((iCY < iNY) && (iCY + iPxY < iNY)) {iNY = iCY + iPxY;} if ((iCY > iNY) && (iCY - iPxY > iNY)) {iNY = iCY - iPxY;} } else { var iMX = ((iNX - iCX) / iS); iMX = (iMX > 0) ? Math.ceil(iMX) : Math.floor(iMX); iNX = iCX + iMX; var iMY = ((iNY - iCY) / iS); iMY = (iMY > 0) ? Math.ceil(iMY) : Math.floor(iMY); iNY = iCY + iMY; } if ((parseInt(navigator.appVersion)>4 || navigator.userAgent.indexOf("MSIE")>-1) && (!window.opera)) {sS="px";} if (iMX != 0) {eval("oD.left = '" + iNX + sS + "'");} if (iMY != 0) {eval("oD.top = '" + iNY + sS + "'");} var sFunction = "flevSlideDiv('" + sD + "'," + iX + "," + iY + "," + iS + "," + iPx + ",0)"; oD.tT = setTimeout(sFunction,iT); } else { // sequence sequence++; if (sequence==1) { flevSlideDiv('vpravo',620,104,8,14); flevSlideDiv('snakvpravo', 620,169,8,14); flevSlideDiv('vlevo',-240,113,8,14); flevSlideDiv('snakvlevo', -240,169,8,14); if (document.all) { snak.filters.alpha.opacity=40; } } if (sequence==5) { if (document.all) { snak.filters.alpha.opacity=20; } flevSlideDiv('vlevo',-240,35,10,5); flevSlideDiv('vpravo',620,35,10,5); flevSlideDiv('background',144,-300,20,20); } if (sequence==6) { if (document.all) { snak.filters.alpha.opacity=10; } flevSlideDiv('navvpravo',800,357,2,30); flevSlideDiv('navvlevo',-200,357,2,30); } if (sequence==10) { if (document.all) { snak.filters.alpha.opacity=02; } } if (sequence==11) { window.location.href = link + '&intro=y'; } // Animation on contentpage if (sequence==101) { flevSlideDiv('pad',146,34,2,30); flevSlideDiv('navvpravo',624,0,2,30); flevSlideDiv('navvlevo',-4,0,2,30); } if (sequence==104) { flevSlideDiv('navvpravo',654,0,2,4); flevSlideDiv('navvlevo',-30,0,2,4); } if (sequence==106) { flevSlideDiv('navvpravo',624,0,2,30); flevSlideDiv('navvlevo',0,0,2,30); } if (sequence==108) { deze = MM_findObj('titlediv'); deze.style.visibility = "visible"; } } } function AnimMain() { link = arguments[0]; flevSlideDiv('background',144,-14,1,1); } function OnResize() { if (HM_IE4) { document.all.contents.style.height = document.body.offsetHeight-60; document.all.logoleft.style.height = document.body.offsetHeight-62; document.all.logoright.style.height = document.body.offsetHeight-62; window.resizeBy(0,1); } } function CheckDiv() { // Fixes voor Internet Explorer 4 OnResize(); // Fixes voor Mozilla/Opera/Netscape6 if (!HM_IE) { deze = MM_findObj('menuright'); deze.style.width = "149px"; deze = MM_findObj('menuleft'); deze.style.width = "149px"; deze = MM_findObj('contents'); deze.style.bottom = "0px"; deze.style.height = ""; deze = MM_findObj('titlediv'); deze.style.left = "148px"; deze.style.height = "33px"; deze.style.width = "475px"; deze = MM_findObj('search'); deze.style.left = "624px"; deze = MM_findObj('logoleft'); deze.style.height = ""; deze.style.bottom = "0px"; deze = MM_findObj('logoright'); deze.style.height = ""; deze.style.bottom = "0px"; } // eventuele animatie if (location.href.indexOf("intro")!= -1) { if (HM_DOM) { deze = MM_findObj('contents'); deze.style.top = document.body.offsetHeight; deze = MM_findObj('search'); deze.style.left = 925; deze = MM_findObj('navigation'); deze.style.left = -150; deze = MM_findObj('pad'); deze.style.top = -30; deze = MM_findObj('titlediv'); deze.style.visibility = "hidden"; sequence=100; flevSlideDiv('contents',149,35,10,18); } } }[/code:1:7ebde8f349] Weet iemand hier een oplossing voor ??
  • a href="test.txt" onclick="jefunctie" misschien? t.
  • Sorry, ik was de pagina vergeten :oops: [code:1:03147b6ee9]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <TITLE>najizn</TITLE> <META http-equiv=Content-Type content="text/html; charset=iso-8859-1"> <SCRIPT language=JavaScript> <!-- function SymError() { return true; } window.onerror = SymError; //--> </SCRIPT> <SCRIPT language=javascript src="../script/rotatie.js" type=text/javascript></SCRIPT> <LINK href="../css/najizn.css" type=text/css rel=stylesheet> </HEAD> <BODY text=#000000 bgColor=#ffffff leftMargin=0 topMargin=0 onload=rotateImage();MM_preloadImages('../images/contact_1.gif','../images/disclaimer_1.gif','../images/sitemap_1.gif') marginheight="0" marginwidth="0"> <DIV id=logo style="Z-INDEX: 2; LEFT: 318px; WIDTH: 200px; POSITION: absolute; TOP: 4px; HEIGHT: 115px"><IMG src="../images/znak.gif" name=snak width="75" height="105" border=0 id="snak" style="FILTER: alpha(opacity=90)"> </DIV><DIV id=vlevo style="BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; Z-INDEX: 14; LEFT: -1px; BACKGROUND-IMAGE: url(../images/intro_menu_links.jpg); BORDER-LEFT: #000000 1px solid; WIDTH: 389px; BORDER-BOTTOM: #000000 1px solid; POSITION: absolute; TOP: 113px; layer-background-image: url(../images/intro_menu_links.jpg)" align=right> <table cellspacing=0 cellpadding=0 width="100%" border=0> <tbody> </tbody> </table> <a onclick="AnimMain('../test.txt');" class="aquaheader" href="#">Link 1</a><br> <a onclick="AnimMain('../test.txt');" class="aquaheader" href="#">Link 2</a></DIV> <DIV id=vpravo style="BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; Z-INDEX: 15; LEFT: 387px; BACKGROUND-IMAGE: url(../images/intro_menu_rechts.jpg); BORDER-LEFT: #000000 1px solid; WIDTH: 390px; BORDER-BOTTOM: #000000 1px solid; POSITION: absolute; TOP: 104px; layer-background-image: url(../images/intro_menu_rechts.jpg)"> <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0> <TBODY></TBODY></TABLE> <p><a onclick="AnimMain('../test.txt');" class="aquaheader" href="#">Link 3</a><br> <a onclick="AnimMain('../test.txt');" class="aquaheader" href="#">Link 4</a></p> <p><a href="../test.txt" class="aquaheader">Link 5</a></p> </DIV> <div id=navvpravo style="Z-INDEX: 12; LEFT: 390px; WIDTH: 100px; POSITION: absolute; TOP: 359px; HEIGHT: 30px"> <table valign="center"> <tbody> <tr> <td align="center" valign="middle"><a onMouseOver="MM_swapImage('sitemap1','','../images/sitemap_1.gif',1)" onClick="AnimMain('../content.htm');" onMouseOut=MM_swapImgRestore() href="#"><img id=sitemap height=21 alt=Sitemap src="../images/sitemap_0.gif" width=21 border=0 name=sitemap1> </a></td> <td align="center" valign="middle"><img id=print height=21 alt="Printen niet mogelijk" src="../images/print_2.gif" width=21 border=0 name=print> </td> </tr> </tbody> </table> </div> <DIV id=background style="Z-INDEX: 1; LEFT: 144px; WIDTH: 477px; POSITION: absolute; TOP: -14px; HEIGHT: 55px"></DIV> <DIV id=navvlevo style="Z-INDEX: 11; LEFT: 330px; WIDTH: 60px; POSITION: absolute; TOP: 359px; HEIGHT: 28px"> <TABLE valign="center"> <TBODY> <TR> <TD align="center" valign="middle"><A onmouseover="MM_swapImage('contact','','../images/contact_1.gif',1)" onmouseout=MM_swapImgRestore() href="mailto:info@wmi.nu"><IMG id=contact height=21 alt=Contact src="../images/contact_0.gif" width=21 border=0 name=contact></A></TD> <TD align="center" valign="middle"><A onmouseover="MM_swapImage('disclaimer','','../images/disclaimer_1.gif',1)" onclick="AnimMain('../content.htm');" onmouseout=MM_swapImgRestore() href="#"><IMG id=disclaimer height=21 alt=Disclaimer src="../images/disclaimer_0.gif" width=21 border=0 name=disclaimer></A></TD> </TR> </TBODY> </TABLE> </DIV> <DIV id=snakvpravo style="BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; Z-INDEX: 2; LEFT: 387px; BORDER-LEFT: #000000 1px solid; WIDTH: 390px; BORDER-BOTTOM: #000000 1px solid; POSITION: absolute; TOP: 169px; HEIGHT: 184px"> <DIV valign="bottom"><IMG id=rechtsimg height=184 src="../images/xt423zz1.gif" width=275></DIV></DIV> <DIV id=snakvlevo style="BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; Z-INDEX: 3; LEFT: -1px; BORDER-LEFT: #000000 1px solid; WIDTH: 389px; BORDER-BOTTOM: #000000 1px solid; POSITION: absolute; TOP: 169px; HEIGHT: 184px"> <DIV align=right valign="bottom"><IMG id=linksimg height=184 src="../images/xt423zz3.gif" width=275></DIV></DIV></BODY></HTML>[/code:1:03147b6ee9] [code:1:03147b6ee9]<a onclick="AnimMain('../test.txt');" class="aquaheader" href="#">Link 1</a>[/code:1:03147b6ee9] De fuktie zit al in de pagina, dus ik denk dat het probleem in de javascript zit. Maar dat kan ik ook mis hebben.
  • als het probleem komt door het verkeerd scripten, krijg je toch zo'n geel tekentje onderin? Staat die daar? En wat is de foutmelding? -termin8or
  • Zet voor de gein eens een [color=blue:d2df0e5c56]alert(sequence)[/color:d2df0e5c56] op een goed gekozen plek, dan zie je meteen waar de fout zit. btw: dit is natuurlijk wel heel erg basic debug werk.
  • Ik heb "alert(sequence)" op verschillende plaatsen geprobeert maar geen resultaat. En dat gele driehoekje komt er niet te staan. Misschien zit er geen fout in maar moet er nog ergens een link aan gegeven worden.

Beantwoord deze vraag

Weet jij het antwoord op deze vraag? Registreer of meld je aan met je account

Dit is een gearchiveerde pagina. Antwoorden is niet meer mogelijk.