Hmm.. kopierar jag din kod, som du visar här ovan, och klistrar in den i ett
dokument och testar så fungerar det klockrent. Inga javascript-fel, nada.
Hej!
Hoppas nån vänlig själ vet vad som är fel.
Jag använder en bildmeny med hjälp av javascript. Jag har även två st. iframes på min sida. Jag vill alltså med ett klick byta sidor i de två iframesen.
För det använder jag:
<SCRIPT LANGUAGE="JavaScript">
<!--
function lankar(url1,url2)
{
parent.iframen.location.href=url1;
parent.undermeny.location.href=url2;
}
//-->
</SCRIPT>
Då ser länken ut såhär;
<TD> <a href="javascript:lankar('cms/default.asp?p=info','undermeny_truppen.html');" onclick="selectLink('button_2_')" onmouseover="rollIn('button_2_')" onmouseout="rollOut('button_2_')"><IMG SRC="images/meny_truppen.gif" WIDTH=71 HEIGHT=16 ALT="" border="0" name="button_2_"></a></TD>
Jag får föjande fel:
Rad 79: 'parent.iframen.location' är null eller inte ett obejkt.
De båda scripten funkar när jag bara använder ett av dem så är det är väl att de inte funkar ihop antar jag...
Men det kanske finns nån smarting som kan få det att fungera?
Tacksam för hjälp!
Mvh,
Richard
Hela koden:
<html>
<head>
<script type="text/javascript">
if (document.images) {
button_1_on=new Image;
button_1_on.src="images/meny_start_fill.gif";
button_1_off=new Image;
button_1_off.src="images/meny_start.gif";
button_2_on=new Image;
button_2_on.src="images/meny_truppen_fill.gif";
button_2_off=new Image;
button_2_off.src="images/meny_truppen.gif";
button_3_on=new Image;
button_3_on.src="images/meny_matcher_fill.gif";
button_3_off=new Image;
button_3_off.src="images/meny_matcher.gif";
button_4_on=new Image;
button_4_on.src="images/meny_tabell_fill.gif";
button_4_off=new Image;
button_4_off.src="images/meny_tabell.gif";
button_5_on=new Image;
button_5_on.src="images/meny_statistik_fill.gif";
button_5_off=new Image;
button_5_off.src="images/meny_statistik.gif";
button_6_on=new Image;
button_6_on.src="images/meny_ungdom_fill.gif";
button_6_off=new Image;
button_6_off.src="images/meny_ungdom.gif";
button_7_on=new Image;
button_7_on.src="images/meny_ovrigt_fill.gif";
button_7_off=new Image;
button_7_off.src="images/meny_ovrigt.gif";
button_8_on=new Image;
button_8_on.src="images/meny_gastbok_fill.gif";
button_8_off=new Image;
button_8_off.src="images/meny_gastbok.gif";
var re;
}
function rollIn(imgName){
if (document.images) document[imgName].src=eval(imgName + "on.src");
}
function rollOut(imgName){
if (document.images && re!=imgName) document[imgName].src=eval(imgName + "off.src");
}
function selectLink(imgName){
if(re) document[re].src=eval(re + "off.src");
re = imgName;
}
</script>
<SCRIPT LANGUAGE="JavaScript">
<!--
function lankar(url1,url2)
{
parent.iframen.location.href=url1;
parent.undermeny.location.href=url2;
}
//-->
</SCRIPT>
</head>
<body bgcolor="#000000" text="#000000" LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0>
<div align="center" valign="middle">
<table width="100%" border="0" cellspacing="0" cellpadding="0" height="100%">
<tr>
<td align="center" valign="middle">
<table width="780" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td width="656">
<div align="center">
<TABLE WIDTH=800 BORDER=0 CELLPADDING=0 CELLSPACING=0>
<TR>
<TD COLSPAN=14> <IMG SRC="images/top.gif" WIDTH=800 HEIGHT=6 ALT=""></TD>
</TR>
<TR>
<TD COLSPAN=3> <a href="http://www.rimforsaif.com"><IMG SRC="images/rimforsaifcom.gif" WIDTH=188 HEIGHT=16 ALT="" border="0"></a></TD>
<TD COLSPAN=2> <a href="cms/default.asp?p=startsida" target="iframen" onclick="selectLink('button_1_')" onmouseover="rollIn('button_1_')" onmouseout="rollOut('button_1_')"><IMG SRC="images/meny_start.gif" WIDTH=87 HEIGHT=16 alt="" border="0" name="button_1_"></a></TD>
<TD> <a href="javascript:lankar('cms/default.asp?p=info','undermeny_truppen.html');" onclick="selectLink('button_2_')" onmouseover="rollIn('button_2_')" onmouseout="rollOut('button_2_')"><IMG SRC="images/meny_truppen.gif" WIDTH=71 HEIGHT=16 ALT="" border="0" name="button_2_"></a></TD>
<TD> <a href="cms/default.asp?p=matcher" target="undermeny" onclick="selectLink('button_3_')" onmouseover="rollIn('button_3_')" onmouseout="rollOut('button_3_')"><IMG SRC="images/meny_matcher.gif" WIDTH=75 HEIGHT=16 ALT="" border="0" name="button_3_"></a></TD>
<TD> <a href="cms/default.asp?p=tabell" target="undermeny" onclick="selectLink('button_4_')" onmouseover="rollIn('button_4_')" onmouseout="rollOut('button_4_')"><IMG SRC="images/meny_tabell.gif" WIDTH=60 HEIGHT=16 ALT="" border="0" name="button_4_"></a></TD>
<TD COLSPAN=2> <a href="cms/default.asp?p=statistik" target="undermeny" onclick="selectLink('button_5_')" onmouseover="rollIn('button_5_')" onmouseout="rollOut('button_5_')"><IMG SRC="images/meny_statistik.gif" WIDTH=81 HEIGHT=16 ALT="" border="0" name="button_5_"></a></TD>
<TD> <a href="cms/default.asp?p=ungdom" target="undermeny" onclick="selectLink('button_6_')" onmouseover="rollIn('button_6_')" onmouseout="rollOut('button_6_')"><IMG SRC="images/meny_ungdom.gif" WIDTH=74 HEIGHT=16 ALT="" border="0" name="button_6_"></a></TD>
<TD> <a href="cms/default.asp?p=ovrigt" target="undermeny" onclick="selectLink('button_7_')" onmouseover="rollIn('button_7_')" onmouseout="rollOut('button_7_')"><IMG SRC="images/meny_ovrigt.gif" WIDTH=73 HEIGHT=16 ALT="" border="0" name="button_7_"></a></TD>
<TD> <a href="pb/" target="iframen" onclick="selectLink('button_8_')" onmouseover="rollIn('button_8_')" onmouseout="rollOut('button_8_')"><IMG SRC="images/meny_gastbok.gif" WIDTH=89 HEIGHT=16 ALT="" border="0" name="button_8_"></a></TD>
<TD> <IMG SRC="images/meny_hoger.gif" WIDTH=2 HEIGHT=16 ALT=""></TD>
</TR>
<TR>
<TD> <IMG SRC="images/vanster_topram.gif" WIDTH=2 HEIGHT=187 ALT=""></TD>
<TD COLSPAN=3> </TD>
<TD COLSPAN=5> <a href="http://www.rimforsaif.com"><IMG SRC="images/logga.jpg" WIDTH=328 HEIGHT=187 ALT="" border="0"></a></TD>
<TD COLSPAN=4><IFRAME NAME="undermeny" SCROLLING="no" WIDTH="245" HEIGHT="187" SRC="undermeny.html" FRAMEBORDER="0"></IFRAME> </TD>
<TD> <IMG SRC="images/hoger_topram.gif" WIDTH=2 HEIGHT=187 ALT=""></TD>
</TR>
<TR>
<TD COLSPAN=14> <IMG SRC="images/mitten_ram.gif" WIDTH=800 HEIGHT=9 ALT=""></TD>
</TR>
<TR>
<TD> <IMG SRC="images/vanster_rammitt.gif" WIDTH=2 HEIGHT=323 ALT=""></TD>
<TD background="images/vanster_main.gif"><IFRAME NAME="left" SCROLLING="no" WIDTH="104" HEIGHT="323" SRC="iframe2.html" FRAMEBORDER="0">cms/<br>
default.asp?<br>
p=startsida</IFRAME> </TD>
<TD COLSPAN=11 bgcolor="ffffff"><IFRAME NAME="iframen" SCROLLING="auto" WIDTH="692" HEIGHT="323" SRC="http://rif.preztige.net/pb/" FRAMEBORDER="0">Om
du ser denna text bör du uppdatera din webbläsare!
<br>
--> <a href="http://www.mozilla.org" target="new">Mozilla</a><br>
--> <a href="http://www.microsoft.se" target="new">Internet
Explorer </a></IFRAME></TD>
<TD> <IMG SRC="images/hoger_rammain.gif" WIDTH=2 HEIGHT=323 ALT=""></TD>
</TR>
<TR>
<TD COLSPAN=14> <IMG SRC="images/ram_ner.gif" WIDTH=800 HEIGHT=9 ALT=""></TD>
</TR>
<TR>
<TD> <IMG SRC="images/spacer.gif" WIDTH=2 HEIGHT=1 ALT=""></TD>
<TD> <IMG SRC="images/spacer.gif" WIDTH=104 HEIGHT=1 ALT=""></TD>
<TD> <IMG SRC="images/spacer.gif" WIDTH=82 HEIGHT=1 ALT=""></TD>
<TD> <IMG SRC="images/spacer.gif" WIDTH=37 HEIGHT=1 ALT=""></TD>
<TD> <IMG SRC="images/spacer.gif" WIDTH=50 HEIGHT=1 ALT=""></TD>
<TD> <IMG SRC="images/spacer.gif" WIDTH=71 HEIGHT=1 ALT=""></TD>
<TD> <IMG SRC="images/spacer.gif" WIDTH=75 HEIGHT=1 ALT=""></TD>
<TD> <IMG SRC="images/spacer.gif" WIDTH=60 HEIGHT=1 ALT=""></TD>
<TD> <IMG SRC="images/spacer.gif" WIDTH=72 HEIGHT=1 ALT=""></TD>
<TD> <IMG SRC="images/spacer.gif" WIDTH=9 HEIGHT=1 ALT=""></TD>
<TD> <IMG SRC="images/spacer.gif" WIDTH=74 HEIGHT=1 ALT=""></TD>
<TD> <IMG SRC="images/spacer.gif" WIDTH=73 HEIGHT=1 ALT=""></TD>
<TD> <IMG SRC="images/spacer.gif" WIDTH=89 HEIGHT=1 ALT=""></TD>
<TD> <IMG SRC="images/spacer.gif" WIDTH=2 HEIGHT=1 ALT=""></TD>
</TR>
</TABLE>
</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</body>
</html>

