Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 04-28-2009, 01:54 PM   PM User | #1
cscwebmaster
New Coder

 
Join Date: Apr 2009
Posts: 12
Thanks: 4
Thanked 0 Times in 0 Posts
cscwebmaster is an unknown quantity at this point
Arrow javascript link not working in firefox

Hi I have a numbered image gallery which has a next and previous link which is another way of navigating through the gallery the problem i have that in IE all is fine but doesnt seem to be working in firefox, i would appreciate afew pointers,
regards.

here is the code

<script type="text/javascript">
var currentImage = 1;

function LoadGallery(picNum, captionText)
{
var footer = document.getElementById("footer");
// get the array of all <a> elements in the footer:
var links = footer.getElementsByTagName("a");
// and unclick (change color back to normal) of the current link:
links[currentImage].style.color = "#ffffff";

// then change which is current image
currentImage = picNum; // save current picture number
// and change color of new current link:
links[currentImage].style.color = "#ff9900";

// rest the same
var picture = document.getElementById("childhood_drawings");
if (picture.filters)
{
picture.style.filter="blendTrans(duration=1)";
picture.filters.blendTrans.Apply();
}
picture.src = "../images/childhood_drawings/" + picNum + ".jpg";
if (picture.filters)
{
picture.filters.blendTrans.Play();
}
document.getElementById("topbar").innerHTML = captionText;

return false; // cancel the click
}

function moveBy(what)
{
// where is user asking us to move to??
var moveTo = currentImage + what;
if ( moveTo < 1 || moveTo > 20 ) return; // can't move too far left or right

var footer = document.getElementById("footer");
// get the array of all <a> elements in the footer:
var links = footer.getElementsByTagName("a");
// and then click on that link:
links[moveTo].click( );

return false; // cancel the click
}
</script>

and these are the links that dont work

<a href="#" onclick="return false moveBy(-1)">&lt;</a>
<a href="#" onclick="return false moveBy(+1)">&lt;</a
cscwebmaster is offline   Reply With Quote
Old 04-28-2009, 02:45 PM   PM User | #2
randomuser773
Banned

 
Join Date: Nov 2008
Location: not found
Posts: 284
Thanks: 0
Thanked 53 Times in 51 Posts
randomuser773 can only hope to improve
Quote:
and these are the links that dont work

<a href="#" onclick="return false moveBy(-1)">&lt;</a>
<a href="#" onclick="return false moveBy(+1)">&lt;</a
Incorrect syntax. The function returns false, so use: <a href="#" onclick="return moveBy(-1)">&lt;</a>
randomuser773 is offline   Reply With Quote
Old 04-28-2009, 03:07 PM   PM User | #3
cscwebmaster
New Coder

 
Join Date: Apr 2009
Posts: 12
Thanks: 4
Thanked 0 Times in 0 Posts
cscwebmaster is an unknown quantity at this point
still not working

its still not working its strange that the numbered links work in both browsers but not the back and next links, any ideas anybody????
cscwebmaster is offline   Reply With Quote
Reply

Bookmarks

Tags
gallery, image, javascript, link

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:55 PM.


Advertisement
Log in to turn off these ads.