Welcome to WebmasterWorld Guest from 54.145.209.34

Forum Moderators: open

Compatibility Problem?

javascript not working in 2 out of 3 enabled browsers...

   
6:28 am on May 6, 2007 (gmt 0)

5+ Year Member



I have this script in the head of my webpage and it works in Safari but not in Firefox or IE. Does anyone see anthing in this script that would cause that effect.
The function navigates through internal links inside of an iframe. The URLs are called from a drop down menu.

<SCRIPT LANGUAGE="javascript">

function LinkUp()
{
var number = document.DropDown.DDlinks.selectedIndex;
parent.artistgroup.location= document.DropDown.DDlinks.options[number].value;
}
</SCRIPT>

6:45 am on May 6, 2007 (gmt 0)

5+ Year Member



Okay, I fixed it for the most part...Still an issue with FireFox but I'm pretty sick of trying to accommodate that browser...can't win 'em all.

<SCRIPT LANGUAGE="javascript">

function LinkUp()
{
var number = window.DropDown.DDlinks.selectedIndex;
artistgroup.location= window.DropDown.DDlinks.options[number].value;
}
</SCRIPT>

8:13 pm on May 6, 2007 (gmt 0)

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Accommodate FireFox? Usually it's IE everyone complains about. :-)

If you're doing what I think you're doing, try this. Note it passes the object itself, and operates off of the variable selected index of the field. UNTESTED but this should work, it's pretty academic. Also presuming "artistgroup" is a named frame? You should assign an ID to that too.


<script type="text/javascript">
function LinkUp(selectObject){
var num = selectObject.selectedIndex;
if (num > 0) {
artistgroup.location=selectObject.options[num].value;
}
}
</script>
<select name="whocares" id="doesntmatter" onChange="LinkUp(this);">
<option value="">SELECT</option>
<option value="thispage.html">This Page</option>
<option value="thatpage.html">That Page</option>
</select>
12:31 am on May 7, 2007 (gmt 0)

5+ Year Member



Rocknbil, Thanks for your response. I really appreciate the script. It would be perfect if I were navigating to a different webpage, however, I am using my drop down to navigate internal link (anchors) within an iframe. When I applied the script you put together it would take me to the chosen link but only once after that if I used the dropdown to select another link it wouldn't work. Is there something that I could alter to enable a funtionality as I described?
6:36 am on May 7, 2007 (gmt 0)

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member



So you tried this?

<option value="thispage.html#anchor1">topic 1</option>
<option value="thispage.html#anchor2">topic 2</option>

....

<a name="anchor1" id="anchor1"></a>
.....
<a name="anchor2" id="anchor2"></a>

3:43 pm on May 8, 2007 (gmt 0)

5+ Year Member



just use the hash

<script type="text/javascript">
function LinkUp(selectObject){
artistgroup.location.hash=selectObject.options[selectObject.selectedIndex].value;
}
</script>

<select onChange="LinkUp(this);">
<option value="top">Choose an Anchor</option>
<option value="anchor1">first anchor</option>
<option value="anchor2">second anchor</option>
</select>

<a name="anchor1" id="anchor1"></a>
.....
<a name="anchor2" id="anchor2"></a>

 

Featured Threads

My Threads

Hot Threads This Week

Hot Threads This Month