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

  • SEARCH
  • Home
  • 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 7636689
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T07:44:51+00:00 2026-05-31T07:44:51+00:00

Currently I am trying to use <div> and <span> tags as labels for my

  • 0

Currently I am trying to use <div> and <span> tags as labels for my JavaScript. This works when using IE and Google Chrome, but does not work in FireFox. The JavaScript Error Console says “imgNo is not defined”.

This is the function where I set the div tag:

function next_picture() {
        if (document.images) {
            if (pictureNum < 21) {
                pictureNum++;
                document.TravelAlberta.src = picture[pictureNum].src;
                imgNo.innerHTML = "Image " + (pictureNum + 1) + " of 22";
            }
            else
                alert("This is last picture");
        }
        else
            alert("Your browser does not support images");
    }

This is the code in the Body

<div id="imgNo" class="style1">
    Image 1 of 22</div>
<p class="style1">
    <img alt="" class="style3" src="images/back_button.gif" id="Back" name="Back" onclick="back_picture()" />

    <img alt="" class="style4" src="images/next_button.gif" id="Next" name="Next" onclick="next_picture()" /></p>
  • 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-31T07:44:53+00:00Added an answer on May 31, 2026 at 7:44 am

    Bad practice is causing your problem. Some browser will use element ids for variable names if the variable is not defined. You should use getElementById.

    document.getElementById("imgNo").innerHTML = "Image " + (pictureNum + 1) + " of 22";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently trying to use this gem http://github.com/pengwynn/linkedin . Everything works fine (i.e.
I'm a beginner coder in Ruby and currently I'm trying to use this plugin:
Currently Im trying to do ajax request using jQuery Mobile. I`m trying to use
am currently using google feed api to get feed links dynamically. am trying to
I'm currently trying to use jQuery to fade a particular div which contains a
I am currently trying to use AJAX in my application via jRails. I am
I'm currently trying to use the latest stable fmod ex in my project. I
So i am running into a major issue. I am currently trying to use
I'm having trouble editing an XML file. I'm currently trying to use Nokogiri ,
Currently I am trying to use a bunch of custom perl modules, test.pm as

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.