SitePoint Sponsor |
|
User Tag List
Results 1 to 7 of 7
Thread: Opera Select selected index
-
Mar 20, 2002, 22:30 #1
- Join Date
- Feb 2001
- Location
- Australia
- Posts
- 43
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Opera Select selected index
Hi All,
I have a document that uses the following javascript code to let me know what the currently selected index of a select box is.
PHP Code:document.<form_name>.<select_name>.selectedIndex
Does anyone know of any solutions?
Many Thanks.
-
Mar 20, 2002, 22:57 #2
- Join Date
- Oct 2000
- Location
- Austin, TX
- Posts
- 1,438
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
It should work, can you post the url?
ck :: bringing chris to the masses.
-
Mar 20, 2002, 23:31 #3
- Join Date
- Feb 2001
- Location
- Australia
- Posts
- 43
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I can't post a link as it isn't on the internet.
The page is the top part of a two row frame.
Here is the code:
<script>
function nextsite() {
maxposition = document.browselinks.browseoptions.length;
curposition = document.browselinks.browseoptions.selectedIndex;
if (curposition!=(maxposition-1)) {
curposition++;
document.browselinks.browseoptions.selectedIndex = curposition;
//parent.content.location.href=document.browselinks.browseoptions.selectedIndex.value;
parent.content.location.href=document.browselinks.browseoptions.options[document.browselinks.browseoptions.selectedIndex].value;
}
}
function prevsite() {
curposition = document.browselinks.browseoptions.selectedIndex;
if (curposition>0) {
curposition=curposition-1;
document.browselinks.browseoptions.selectedIndex = curposition;
parent.content.location.href=document.browselinks.browseoptions.selectedIndex.value;
}
}
</script>
</head>
<body>
<table>
<tr>
<td valign="top">
<a href="#" onClick="prevsite();">Previous Site</a>
</td>
<td>
<form name="browselinks" action="">
<select name="browseoptions" onChange="parent.content.location.href = this.options[this.selectedIndex].value;">
<option selected></option>
<option value="http://link1.com">This is link1</option>
<option value="http://link2.com">This is link2</option>
<option value="http://link3.com">This is link3</option>
</select>
</form>
</td>
<td valign="top">
<a href="#" onClick="nextsite();">Next Site</a>
<!-- document.browselinks.browseoptions.selectedIndex -->
</td>
<td>
<script>
var value1=document.browselinks.browseoptions.length;
var value2 = document.browselinks.browseoptions.selectedIndex;
document.write(value1);
document.write(value2);
//This is a test to see if the selected index works in Opera
</script>
</td>
</tr>
</table>
-
Mar 20, 2002, 23:38 #4
- Join Date
- Oct 2000
- Location
- Austin, TX
- Posts
- 1,438
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
The transfer line (parent.content.location.href=...) in prevsite() is wrong, it should be the same as the one in nextsite().
ck :: bringing chris to the masses.
-
Mar 20, 2002, 23:49 #5
- Join Date
- Feb 2001
- Location
- Australia
- Posts
- 43
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
That bit works fine - it is the code:
document.<form_name>.<select_name>.selectedIndex
that doesn't work in Opera.
-
Mar 21, 2002, 00:34 #6
- Join Date
- Oct 2000
- Location
- Austin, TX
- Posts
- 1,438
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
No, that part works fine. What line are you talking about?
ck :: bringing chris to the masses.
-
Mar 21, 2002, 00:44 #7
- Join Date
- Feb 2001
- Location
- Australia
- Posts
- 43
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
The bit here:
<script>
var value1=document.browselinks.browseoptions.length;
var value2 = document.browselinks.browseoptions.selectedIndex;
document.write(value1);
document.write(value2);
//This is a test to see if the selected index works in Opera
</script>
Bookmarks