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 448859
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T21:42:42+00:00 2026-05-12T21:42:42+00:00

i have some javascript in the head of a page that controls an image

  • 0

i have some javascript in the head of a page that controls an image gallery where the user clicks a thumbnail image and a larger image and some text are revealed in a span. there are 10 of these thumbnails per page and i need to find out how to set the 1st thumbnail’s hidden span to “block” on page load.


<script type="text/javascript">
function hideSpan(spanName) {

var obj = document.getElementById(spanName);
obj.style.border="0px";
obj.style.color="#fff";
obj.style.display="none";
obj.style.left="333px";
obj.style.padding="0";
obj.style.position="absolute";
obj.style.top="55px";
obj.style.width="244px";
}

function showSpan(spanName) {

var spanEl, count = 1;
while(spanEl = document.getElementById('link' + count++)){
spanEl.style.display = 'none';
}

var obj = document.getElementById(spanName);
obj.style.display="block";
}

</script>

any help with this is VERY appreciated thank you.

  • 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-12T21:42:42+00:00Added an answer on May 12, 2026 at 9:42 pm

    The simple, breezy way is to do this:

    <body onload="showSpan('link1');">
    

    The trouble here is that the onload event attached to body that way is executed a little late in the page loading (After all the parts– including images– are loaded) so it’ll be murder for your dial up users. jQuery implements a much better way:

    $(document).ready(function () {
        showSpan('link1');
    });
    

    If you’re not using jQuery, then someone here much wiser than I more than likely knows the correct way to do it using “proper” JavaScript, I don’t remember the event name that jQuery uses off the top of my head.

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

Sidebar

Related Questions

Suppose I have following html page. <html> <head> <link type=text/css rel=Stylesheet href=css/some.css /> </head>
We have some JavaScript code that resizes <div/> elements (adjusts height/width/padding/margin etc.) based on
I'm working on some custom Javascript for a CMS template at work. I want
This is in ASP.NET. We are using a ExtJS frontend, and have our own
i have a problem so hope you guys can help! I have a string
The problem: I am embedding a CSS file into a custom control library with
I'm trying to get a simple Lift example running and I'm having a strange
I am trying to rework many pages across many sites. The pages may contain
This was interesting. In a select dropdown, trying not to use jQuery (with the
I cannot get Raphaël working in a UIWebView. I load a simple HTML-Webpage with

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.