Is dit mogelijk ?

Status
Niet open voor verdere reacties.

jolyjump

Gebruiker
Lid geworden
29 mrt 2001
Berichten
129
Ik heb een stuk code genomen, om mijn movie catalog te creeren, doch zit nu met een vraagje:

Is het mogelijk om een iframe te laden, bij elke keuze die ik maak in de select list, telkens ik op de up/down pijtjes druk van het toetsenbord.
zodat als ik op de eerste film klik, movieslist_1.html geladen word, wat nu werkt, doch als ik dan op het "Down" pijltje druk (op het keyboard), dat niet enkel End of days tevoorschijn komt in de select box, maar ook direct de iframe zich aanpast naar movieslist_2.html ?



Code:
<!-- The code below is the JavaScript Code in the HEAD of this document that works the drop down menu-->

<script type="text/javascript">
<!--//
function goToPage763(mySelect)
{
PageIndex2=mySelect.selectedIndex;
{
if
(
mySelect.options[PageIndex2].value != "none"
)
{
//this is the key code in the JavaScript to open the new page in

//the iframe:-

frames['iframe2'].location.href = mySelect.options[PageIndex2].value;

}

}

}

//-->

</script>

<form name="form763">

<p>

<select name="select763" size="1" onchange="goToPage763(this.form.select763)">

<option value="none" selected="selected">

Pick a movie

</option>

<option value="movieslist_1.html">

Bird on a wire

</option>

<option value="movieslist_2.html">

End of days

</option>

<option value="movieslist_3.html">

Enemy of the state

</option>

<iframe name="iframe2" src="index.html" align="top" height="100%" width="95%" hspace="10" vspace="10" align="middle">

</select>

</p>

<p>

<!-- The code below is the code in the body of this document that writes the form-->

<iframe name="iframe2" src="index.html" align="top" height="100%" width="95%" hspace="10" vspace="10" align="middle">

If you can see this, your browser does not support iframes!

</iframe>

</p>

</form>
 
Moet het volgende stukje code niet nog een aanvullinkje hebben?

PHP:
<select name="select763" size="1" onchange="goToPage763(this.form.select763.value)">
i.p.v.
PHP:
<select name="select763" size="1" onchange="goToPage763(this.form.select763)">

Greetz : Jer:cool:en.
 
Ik ben opnieuw begonnen, doch ik krijg geen iframe als ik van keuze verander. :confused:

Code:
<!-- The code below is the Javascript Code in the HEAD of this document that works the drop down menu-->
<script type="text/javascript">
<!--//
function goToPage763(mySelect)
{
PageIndex2=mySelect.selectedIndex;
{
if
(
mySelect.options[PageIndex2].value != "none"
)
{
//this is the key code in the Javascript to open the new page in
//the iframe:-
frames['iframe2'].location.href = mySelect.options[PageIndex2].value;
}
}
}
//-->
</script>
<form name="form763">
<p>
<select name="select763" size="1" onchange="goToPage763(this.form.select763).value">
<option value="none" selected="selected">
Pick a movie
</option>
<option value="movieslist_1.html">
Bird on a wire
</option>
<option value="movieslist_2.html">
End of days
</option>
<option value="movieslist_3.html">
Enemy of the state
</option>
<iframe name="iframe2" src="index.html" align="top" height="100%" width="95%" hspace="10" vspace="10" align="middle">
</select>
</p>
<p>
<!-- The code below is the code in the body of this document that writes the form-->
<iframe name="iframe2" src="index.html" align="top" height="100%" width="95%" hspace="10" vspace="10" align="middle">
If you can see this, your browser does not support iframes!
</iframe>
</p>
</form>
 
De ".value" komt tussen de haakjes.

Greetz : Jer:cool:en.
 
Dan doet ie helemaal niets meer.

Als ik naar de volgende ga met mijn pijltjes, verandert de iframe niet, wel als ik op enter druk, maar dat zou niet moeten, hij zou automatisch de nieuwe selectie moeten laden.
Als ik .value toevoeg dan helpt op enter drukken ook niet meer.
 
Je hebt gelijk, ik ben nog een stukje vergeten waardoor het wel zou moeten werken.

PHP:
<select name="select763" size="1"
onchange="goToPage763(this.form.select763[this.form.select763.selectedIndex].value)">

Mocht dit toch niet werken, dan zal ik zelf eens moeten zoeken wat het wel zal doen.

Greetz : Jer:cool:en.
 
Code:
<!-- The code below is the JavaScript Code in the HEAD of this document that works the drop down menu-->
<script type="text/javascript">
<!--//
function goToPage763(mySelect) {
PageIndex2=mySelect.selectedIndex;
{
if (mySelect.options[PageIndex2].value != "none") {
//this is the key code in the JavaScript to open the new page in
//the iframe:-
frames['iframe2'].location.href = mySelect.options[PageIndex2].value;
}
}
}
//-->
</script>
<form name="form763">
<p>
<select name="select763" size="1" onchange="goToPage763(this.form.select763)">
<option value="none" selected="selected">
Pick a movie
</option>
<option value="movieslist_1.html">
Bird on a wire
</option>
<option value="movieslist_2.html">
End of days
</option>
<option value="movieslist_3.html">
Enemy of the state
</option>
<iframe name="iframe2" src="index.html" align="top" height="100%" width="95%" hspace="10" vspace="10" align="middle">
</select>
</p>
<p>
<!-- The code below is the code in the body of this document that writes the form-->
<iframe name="iframe2" src="index.html" align="top" height="100%" width="95%" hspace="10" vspace="10" align="middle">
If you can see this, your browser does not support iframes!
</iframe>
</p>
</form>


Deze werkt nu mooi in IE. In FireFox werkt hij maar half, daar word het niet geupdate als ik gewoon naar de volgende ga met de pijltjes, in FireFox moet ik effectief clicken op de filmnaam.
 
Goed dat het gelukt is :thumb:.

Greetz : Jer:cool:en.
 
Status
Niet open voor verdere reacties.

Nieuwste berichten

Terug
Bovenaan Onderaan