Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7444833
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T11:35:52+00:00 2026-05-29T11:35:52+00:00

On my website, I have an image viewer. Every time the user click the

  • 0

On my website, I have an image viewer. Every time the user click the left or right button the url of the page will be changed aromatically. The image src uses a specific number from the url of the current page (the only number in the url). Below I have provided the code I am using. The code is working perfectly, but it is only working on mozilla firefox. How can I fix it in order to make it work for all browsers. The problem on the other browsers is that the image do not show up.

<img src="" id="image" >
    <script type="text/javascript">
        document.getElementById('image').src ="Images/"+location.href.match(/\d+/)+".jpg";
        <br/>
        document.wrriteln(location.href.match(/\d+/)+".jpg");
    </script>
    <br/>
    <script>
    var url = location.href;
    function nextImage() {
        return(url.replace(/(\d+)(\.html)$/, function(str, p1, p2) {
            return((Number(p1) + 1) + p2);
        }));
    }
    function prevImage() {
        return(url.replace(/(\d+)(\.html)$/, function(str, p1, p2) {
            return((Number(p1) - 1) + p2);
        }));
    }
    </script>
      <a href="javascript: window.location.href = prevImage();"> <img border="0" src="Assets/Left.png" /></a>
      <a href="javascript: window.location.href = nextImage();"> <img border="0" src="Assets/Right.png"/></a>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T11:35:52+00:00Added an answer on May 29, 2026 at 11:35 am

    What you should do is

    <a href="#" id="prevImageControl">
    

    and in the javascript block do

    prevImageClick = function()
    {
        window.location.href = prevImage();
    }
    
    var prevImageControl = document.getElementById('prevImageControl');
    prevImageControl.addEventListener('click', prevImageClick);
    

    repeat for nextImage()

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two side borders on my website, left and right side... small image
I want that each user on my website will have an image in his
I have an image on my website. I would like when I click it,
I noticed that many website have a nice 'feedback' button in their page. It
My users have pages: user favorites users image I try to do a page
I have website display images, each image has its facebook-like button linked to its
Imagine you have a classifieds website... When searching ads you want image thumbnails of
On a customer website, I have to add a background image for only a
I have Image which belongsTo User, and I have Coupon which belongsTo User. Each
I have a client requesting an animated/panned image be added to their website. Basically,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.