Toon posts:

[Javascript] Document SRC probleem

Pagina: 1
Acties:

Verwijderd

Topicstarter
Hoi,

Er blijkt een hardnekkig probleem te zitten in dit script.
Met de functie imgOn() probeer ik alle images met naam plip0 tot plip2 te veranderen (uit te zetten bij wijze van spreken), daarna verander ik 1 van deze in een andere image (aanzetten dus).

Naast dit heb ik de mouseover style voor het navigatie menu in enkele andere functies gestoken.

Het probleem is nu dat bij de whilelus hij blijkbaar niet begint bij de images met naam plip0 maar hij neemt gewoon de eerste image met een naam die ie tegenkomt (de images in het menu natuurlijk) en verandert deze :(

Enig idee hoe ik dit kan verhelpen zodat de whilelus de juiste image veranderd?

HIERBIJ DE CODE:
__________________________________
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> Millennium Golf </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="Verticaldot">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
<LINK REL="stylesheet" HREF="style.css" TYPE="text/css">
<script language="JavaScript" type="text/javascript">
// Pano Functions
function pano01() {
document.pmvr.set('image','panos/hole01/01.jpg');
document.pmvr.set('center','0');
document.pmvr.set('view','0');
 }

// Panomenu Functions
function imageOn(name) {
var i = 0;
var j = ""; 
while(i < 2) {
    j = "plip" + i;
    document[j].src="../img/interf/off.gif";
    i++;
}
document[name].src="../img/interf/on.gif";
}

// Navigation Functions
function swapleftarrow() {
document.leftarrow.src="img/interf/nav-left-over.gif";
}
function restoreleftarrow() {
document.leftarrow.src="img/interf/nav-left-normal.gif";
}
function swaprightarrow() {
document.rightarrow.src="img/interf/nav-right-over.gif";
}
function restorerightarrow() {
document.rightarrow.src="img/interf/nav-right-normal.gif";
}
</script>

</HEAD>

<BODY>

<TABLE cellpadding="0" cellspacing="0" border="0" width="650" align="center" class="greenborder" bgcolor="#C0CCA8">
<TR>
<TD>

    <TABLE cellpadding="0" cellspacing="0" border="0" width="650">
        <TR>
            <TD>[img]"img/interf/top.gif"[/img]</TD>
        </TR>
    </TABLE>

    <TABLE cellpadding="0" cellspacing="0" border="0" width="650">
        <TR>
            <TD width="59"><a href="javascript:;" OnMouseover="swapleftarrow();" OnMouseout="restoreleftarrow()">[img]"img/interf/nav-left-normal.gif"[/img]</a></TD>
            <TD width="532" align="center" bgcolor="849367">[img]"img/titles/hole01.gif"[/img]</TD>
            <TD width="59"><a href="javascript:;" OnMouseover="swaprightarrow();" OnMouseout="restorerightarrow()">[img]"img/interf/nav-right-normal.gif"[/img]</a></TD>
        </TR>
    </TABLE>
    <br>
    <TABLE cellpadding="0" cellspacing="0" border="0" width="600" class="blackborder" align="center" height="280">
        <TR>
            <TD width="150">
            <!-- START Menu VT -->
            <table border=0 cellspacing=0 cellpadding=2>
                <TR>
                    <TD>[img]"img/interf/off.gif"[/img]</TD>
                    <TD><a href="#" onClick="pano01(); imageOn(0);">Living</a></TD>
                </TR>
                <TR>
                    <TD>[img]"img/interf/off.gif"[/img]</TD>
                    <TD><a href="#" onClick="pano01(); imageOn(1);">Living</a></TD>
                </TR>
                <TR>
                    <TD>[img]"img/interf/off.gif"[/img]</TD>
                    <TD><a href="#" onClick="pano01(); imageOn(1);">Living</a></TD>
                </TR>
            </TABLE>
            <!-- END menu VT -->
            </TD>
            <!-- START PMVR -->
            <TD width="450">
            <applet name="pmvr" code="pmvr.class" width=450 height=280>
                  <param name="image" value="panos/hole01/01.jpg">
                  <param name="view" value="0">
                  <param name="zoom" value="0">
                  <param name="arrows" value="0">
                  <param name="auto" value="10">
                  <param name="zMAX" value="200">
                  <param name="delay" value="1000">
             </applet></TD>
             <!-- END PMVR -->
        </TR>
    </TABLE>

    <center>
        <div class="textveld"></div>
    </center>

</TD>
</TR>
</TABLE>

</BODY>
</HTML>

  • Pelle
  • Registratie: Januari 2001
  • Laatst online: 02:40

Pelle

🚴‍♂️

document.images

Verwijderd

Topicstarter
Dat is het niet :)

Maar het probleem is wel opgelost. Blijkbaar had het te maken met de locatie waar je de SRC naar verwijst. Die url was verkeerd, ipv "../img/interf/on.gif" moest het zijn "img/interf/on.gif"

Dit heeft het probleem verholpen. vreemd maar waar :)

thanks for quick reply tho :)

  • crisp
  • Registratie: Februari 2000
  • Nu online

crisp

Devver

Pixelated

Verwijderd schreef op 19 August 2003 @ 13:37:
Dat is het niet :)

Maar het probleem is wel opgelost. Blijkbaar had het te maken met de locatie waar je de SRC naar verwijst. Die url was verkeerd, ipv "../img/interf/on.gif" moest het zijn "img/interf/on.gif"

Dit heeft het probleem verholpen. vreemd maar waar :)

thanks for quick reply tho :)
Toch is het niet netjes om elementen op deze manier aan te spreken; w3c zegt het volgende over het name attribuut:
This attribute has been included for backwards compatibility. Applications should use the id attribute to identify elements
In XHTML is meen ik het name attribuut niet eens meer toegestaan voor een img-tag

daarbij is document.images['img'] nog steeds te prefereren boven document['img'] wat eigenlijk gewoon een andere schrijfwijze is voor de ranzige dot-notatie document.img

[ Voor 37% gewijzigd door crisp op 19-08-2003 13:56 ]

Intentionally left blank