homepage Welcome to WebmasterWorld Guest from 54.163.139.36
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
Compatibility Problem?
javascript not working in 2 out of 3 enabled browsers...
capulet_x

5+ Year Member



 
Msg#: 3332005 posted 6:28 am on May 6, 2007 (gmt 0)

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>

 

capulet_x

5+ Year Member



 
Msg#: 3332005 posted 6:45 am on May 6, 2007 (gmt 0)

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>

rocknbil

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



 
Msg#: 3332005 posted 8:13 pm on May 6, 2007 (gmt 0)

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>

capulet_x

5+ Year Member



 
Msg#: 3332005 posted 12:31 am on May 7, 2007 (gmt 0)

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?

rocknbil

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



 
Msg#: 3332005 posted 6:36 am on May 7, 2007 (gmt 0)

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>

Drag_Racer

5+ Year Member



 
Msg#: 3332005 posted 3:43 pm on May 8, 2007 (gmt 0)

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>

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved